简体   繁体   English

maven-jaxb2-plugin中的AutoNameResolution

[英]AutoNameResolution in maven-jaxb2-plugin

I am not able to get AutoNameResolution to work in maven-jaxb2-plugin. 我无法让AutoNameResolution在maven-jaxb2-plugin中运行。 Below is my pom file 下面是我的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>

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." 我得到的错误是"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. 由于我正在使用第三方wsdl,从中我不会消耗大多数函数,我只想要一个简单的自动解决,而不是为我不使用的东西编写绑定。

I tried with apache cxf as well. 我也试过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>

I ran this with both <extraarg>-autoNameResolution</extraarg> and 我用<extraarg>-autoNameResolution</extraarg>

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

Still the same issue "Two declarations cause a collision in the ObjectFactory class." 仍然是同一个问题"Two declarations cause a collision in the ObjectFactory class."

How can I just get autoNameResolve to work? 我怎样才能让autoNameResolve工作?

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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM