maven-jaxb2-plugin 中的 AutoNameResolution

AutoNameResolution in maven-jaxb2-plugin

我无法让 AutoNameResolution 在 maven-jaxb2-plugin 中工作。 下面是我的 pom 文件

<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>

我不知道哪里出了问题。我得到的错误是 "A class/interface with the same name is already in use. Use a class customization to resolve this conflict." 由于我使用的是第三方 wsdl,我不会从中使用大多数功能,所以我只想要一个简单的自动解析,而不是为我不使用的东西编写绑定。

我也尝试使用 apache cxf。

<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>

我 运行 这与 <extraarg>-autoNameResolution</extraarg>

<defaultOptions>
    <autoNameResolution>true</autoNameResolution>
</defaultOptions>

还是一样的问题"Two declarations cause a collision in the ObjectFactory class."

我怎样才能让 autoNameResolve 工作?

编辑 我在调试中看到如下日志。

[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)

尝试删除:

<generatePackage>com.commp.soap.service</generatePackage>

<extraarg>-p</extraarg>
<extraarg>com.projects.webservicex.service</extraarg>