I am not able to get AutoNameResolution to work in maven-jaxb2-plugin. Below is my pom file
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.13.2</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<args>
<arg>-XautoNameResolution</arg>
</args>
<schemaLanguage>WSDL</schemaLanguage>
<generatePackage>com.commp.soap.service</generatePackage>
<schemas>
<schema>
<url>https://urltowsdl</url>
</schema>
</schemas>
</configuration>
</plugin>
I am not able to figure out where I am going wrong. All I get in the error is "A class/interface with the same name is already in use. Use a class customization to resolve this conflict."
Since I am consuming a third-party wsdl, from which most functions I wont be consuming I just want a simple autoresolve rather than writing bindings for stuff I donot use.
I tried with apache cxf as well.
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>stock-quote-service</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${project.basedir}/src/main/generated_java</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${project.basedir}/src/main/resources/wsdl/consume.wsdl</wsdl>
<wsdlLocation>http://usrltoWsdl</wsdlLocation>
<serviceName>Consumer</serviceName>
<extraargs>
<extraarg>-verbose</extraarg>
<extraarg>-p</extraarg>
<extraarg>com.projects.webservicex.service</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.9.1</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-xjc-ts</artifactId>
<version>2.2.9</version>
</dependency>
</dependencies>
</plugin>
I ran this with both <extraarg>-autoNameResolution</extraarg>
and
<defaultOptions>
<autoNameResolution>true</autoNameResolution>
</defaultOptions>
Still the same issue "Two declarations cause a collision in the ObjectFactory class."
How can I just get autoNameResolve to work?
EDIT I see log like the following in the debug.
[DEBUG] Resolving publicId [http://url/webservices/es/common], systemId [null].
resolvePublic(http://url/webservices/es/common,null)
[DEBUG] Parent resolver has resolved publicId [http://url/webservices/es/common], systemId [null] to [null].
[DEBUG] Resolving publicId [http://url/webservices/es/constants], systemId [null].
resolvePublic(http://url/webservices/es/constants,null)
Try to remove:
<generatePackage>com.commp.soap.service</generatePackage>
and
<extraarg>-p</extraarg>
<extraarg>com.projects.webservicex.service</extraarg>