我们对我们的应用程序有特殊要求:针对wsdl 生成的文件应具有给定的包名称,并且针对xsd文件生成的文件 应该有另一个包名。
似乎没有办法使用jaxws maven插件自定义它。这是我们目前的配置:
<execution>
<id>wsimport-finderpro</id>
<phase>generate-sources</phase>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<bindingDirectory>src/main/resources/xml-resources/web-service-references/B2T_DataModel.asmx/xsd</bindingDirectory>
<bindingFiles>
<bindingFile>ServerResponse_login.xsd</bindingFile>
<bindingFile>OpenDirectAccessSession.xsd</bindingFile>
</bindingFiles>
<!--wsdls file directory -->
<wsdlDirectory>src/main/resources/xml-resources/web-service-references/B2T_DataModel.asmx/wsdl</wsdlDirectory>
<!-- which wsdl file -->
<wsdlFiles>
<wsdlFile>B2T_DataModel.asmx.wsdl</wsdlFile>
</wsdlFiles>
<!-- Keep generated files -->
<keep>true</keep>
<!-- Package name -->
<packageName>com.mycompany.world.worldlink.finderpro.ws</packageName>
<!-- generated source files destination-->
<sourceDestDir>target/generated-code/src</sourceDestDir>
<staleFile>target/jaxws/fp/.staleFlag</staleFile>
<target>2.1</target>
</configuration>
</execution>
有人可以提供建议吗?
编辑1 :我想出了以下代码:
<execution>
<id>wsimport-finderpro-01</id>
<phase>generate-sources</phase>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<bindingDirectory>src/main/resources/xml-resources/web-service-references/B2T_DataModel.asmx/xsd</bindingDirectory>
<bindingFiles>
<bindingFile>OpenDirectAccessSession.xsd</bindingFile>
</bindingFiles>
<!--wsdls file directory -->
<wsdlDirectory>src/main/resources/xml-resources/web-service-references/B2T_DataModel.asmx/wsdl</wsdlDirectory>
<!-- which wsdl file -->
<wsdlFiles>
<wsdlFile>B2T_DataModel.asmx.wsdl</wsdlFile>
</wsdlFiles>
<!-- Keep generated files -->
<keep>true</keep>
<!-- Package name -->
<packageName>com.ids.world.worldlink.finderpro.xmlstubs</packageName>
<!-- generated source files destination-->
<sourceDestDir>target/generated-code/src</sourceDestDir>
<staleFile>target/jaxws/fp-01/.staleFlag</staleFile>
<target>2.1</target>
</configuration>
</execution>
<execution>
<id>wsimport-finderpro-02</id>
<phase>generate-sources</phase>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<bindingDirectory>src/main/resources/xml-resources/web-service-references/B2T_DataModel.asmx/xsd</bindingDirectory>
<bindingFiles>
<bindingFile>GetAllMyEntityQuotes.xsd</bindingFile>
</bindingFiles>
<!--wsdls file directory -->
<wsdlDirectory>src/main/resources/xml-resources/web-service-references/B2T_DataModel.asmx/wsdl</wsdlDirectory>
<!-- which wsdl file -->
<wsdlFiles>
<wsdlFile>B2T_DataModel.asmx.wsdl</wsdlFile>
</wsdlFiles>
<!-- Keep generated files -->
<keep>true</keep>
<!-- Package name -->
<packageName>com.ids.world.worldlink.finderpro.xmlstubs.allMyEntityQuotes</packageName>
<!-- generated source files destination-->
<sourceDestDir>target/generated-code/src</sourceDestDir>
<staleFile>target/jaxws/fp-02/.staleFlag</staleFile>
<target>2.1</target>
</configuration>
</execution>
问题在于我注意到很多类都被重新生成了几次(这里是x2),我最终在不同的包中使用相同的类。
如何确保为wsdl生成的类生成一次,并生成xsd的类并将其放在各自的包中?