So I had to use Axis's ant tasks for wsdl2java. I did it like this:
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<configuration>
<tasks>
<path id="compile_classpath" refid="maven.compile.classpath"/>
<taskdef resource="axis-tasks.properties" classpathref="compile_classpath" />
<property name="legacyService.wsdl" value="src/main/resources/ref-wsdl/legacy.wsdl"/>
<property name="newOne.wsdl" value="http://your.host/service.wsdl"/>
<property name="generated.dir" value="src/main/java"/>
<axis-wsdl2java output="${generated.dir}" verbose="true" url="${legacyService.wsdl}" >
<mapping namespace="urn:ServiceNameSpace" package="com.rst.webservice.legacy.client.axis14.util" />
</axis-wsdl2java>
<axis-wsdl2java output="${generated.dir}" verbose="true" url="${newOne.wsdl}" >
<mapping namespace="http://webservice.rst.com" package="com.rst.webservice.newone.client.axis14.util" />
</axis-wsdl2java>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<!-- ..... -->
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis-ant</artifactId>
<version>1.4</version>
</dependency>
<!-- ..... -->
<dependencies>
Now, if you observe the above piece of pom.xml, axis:wsdl2java task is executed in 'generate-sources' phase, and Maven needs axis-ant.jar to execute that, but it is not available to Maven by default. So we need to provide Maven with this dependency.
How to provide this dependency to maven?
Now that's tricky, if you see the Documentation page about Maven Classpaths for ant-tasks then you would notice that the classpath that Maven refers to for executing various goals is not available as built-in variable. So I could have defined a path variable with hard-coded path to axis-ant.jar or I could define a 'dependency' to axis-ant and refer to maven.compile.classpath. And as you see I chose the second approach.