如何修改從多個wsdls生成的java類的包名稱。我有兩個wsdls,並且都使用完全相同的包名稱生成像ObjectFactory,package-info等類。因此,我無法在我的代碼中組織導入。我的包看起來像這樣的WSDL文件 -修改從wsdl生成的java類的包名稱
WSDL A
com.test.customerinfo.dto
com.test.customerinfo.exceptions
com.test.customerinfo.service
WSDL B
com.test.customerinfo.dto
com.test.customerinfo.exceptions
com.test.customerinfo.service
我希望它看起來是這樣的 -
WSDL A
com.test.customerinfo.dto
com.test.customerinfo.exceptions
com.test.customerinfo.service
WSDL B
com.testOne.customerinfo.dto
com.testOne.customerinfo.exceptions
com.testOne.customerinfo.service
我想這一點,但沒有奏效 -
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>2.7.7</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>target/generated-sources/test/java</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>src/main/resources/wsdl/test/GetInfo.wsdl</wsdl>
<extraargs>
<extraarg>-server</extraarg>
<extraarg>-client</extraarg>
<extraarg>-impl</extraarg>
<extraarg>-verbose</extraarg>
<extraarg>-p</extraarg>
<extraarg>http://dto.customerinfo.test.com/=com.test.customerinfo.dto</extraarg>
<extraarg>-p</extraarg>
<extraarg>http://services.customerinfo.test.com/=com.test.customerinfo.services</extraarg>
<extraarg>-p</extraarg>
<extraarg>http://exceptions.customerinfo.test.com/=com.test.customerinfo.exceptions</extraarg>
</extraargs>
<frontEnd>jaxws21</frontEnd>
<faultSerialVersionUID>1</faultSerialVersionUID>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
請指教。
你如何生成從WSDL類?你使用哪種工具?例如,如果使用[CXF](http://cxf.apache.org/docs/wsdl-to-java.html),可以使用'-p [wsdl-namespace =] PackageName' –
完成它我想要它在pom.xml中定義。你在這裏給出的選項是命令行。 – rickygrimes
你使用'cxf-codegen-plugin'嗎? –