I have 2 WSDL's namely UserStore.wsdl and Authorization.wsdl with xmlns:ns="http://service.ws.um.carbon.wso2.org"
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<vmArgs>
<vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
</vmArgs>
<args>
<arg>-B-XautoNameResolution</arg>
</args>
<wsdlFiles>
<wsdlFile>RemoteAuthorizationManagerService.wsdl</wsdlFile>
</wsdlFiles>
<wsdlDirectory>${basedir}/src/main/wsdl</wsdlDirectory>
<staleFile>${project.build.directory}/jaxws/stale/RemoteAuthorizationManagerService.stale</staleFile>
<wsdlLocation>/META-INF/wsdl/RemoteAuthorizationManagerService.wsdl</wsdlLocation>
</configuration>
<id>wsimport-generate-RemoteAuthorizationManagerService</id>
<phase>generate-sources</phase>
</execution>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<vmArgs>
<vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
</vmArgs>
<args>
<arg>-B-XautoNameResolution</arg>
</args>
<wsdlFiles>
<wsdlFile>RemoteUserStoreManagerService.wsdl</wsdlFile>
</wsdlFiles>
<wsdlDirectory>${basedir}/src/main/wsdl</wsdlDirectory>
<staleFile>${project.build.directory}/jaxws/stale/RemoteUserStoreManagerService.stale</staleFile>
<wsdlLocation>/META-INF/wsdl/RemoteUserStoreManagerService.wsdl</wsdlLocation>
<sourceDestDir>${project.build.directory}/generated-sources/xjc</sourceDestDir>
<compilerArgument>-proc:none</compilerArgument>
</configuration>
<id>wsimport-generate-RemoteUserStoreManagerService</id>
<phase>generate-sources</phase>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>webservices-api</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<configuration>
<sourceDestDir>${project.build.directory}/generated-sources/jaxws-wsimport-wsdl</sourceDestDir>
<xnocompile>true</xnocompile>
<verbose>true</verbose>
<extension>true</extension>
<keep>true</keep>
<catalog>${basedir}/src/jax-ws-catalog.xml</catalog>
<compilerArgument>-proc:none</compilerArgument>
</configuration>
</plugin>
The root cause what we are facing is ObjectFactory classes are getting generated under different folders XJC and jaxws-wsimport-wsdl [as mentioned in sourceDestDir tag] but with the same package namely [org.wso2.carbon.um.ws.service.ObjectFactory] due to which compiler complains The type ObjectFactory is already defined and JAR file is not getting generated.
Also tried giving
<compilerArgument>-proc:none</compilerArgument>
which didn't work.
We are not allowed to modify the WSDL's and needs to be resolved this problem.
Thanks in Advance.