我有两个wsdl,即userstore.wsdl和authorization.wsdlxmlns: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>
我们面临的根本原因是objectfactory类是在不同的文件夹xjc和jaxws wsimport wsdl下生成的[如sourcedestdir标记中所述],但是使用相同的包,即[org.wso2.carbon.um.ws.service.objectfactory],由于该包,编译器抱怨类型objectfactory已经定义,而jar文件没有得到生成。
也试过给予
<compilerArgument>-proc:none</compilerArgument>
但没用。
我们不允许修改wsdl,需要解决这个问题。
提前谢谢。
1条答案
按热度按时间wkyowqbh1#
所以我对你的问题的理解是你想要定义不同的包?
要使用绑定文件配置目标包,请执行以下操作:
https://github.com/highsource/maven-jaxb2-plugin/wiki/configure-target-packages-in-binding-files#configure-绑定文件中的目标包
你也可以使用
类似问题:
定制java包jaxb wsimport
如何使用maven和wsimport从wsdl生成类?