[英]Force cxf-codegen-plugin to use existing generated classes instead of creating new ones
I have a set of XSD (A and B) and their corresponding Java classes are generated by maven-jaxb2-plugin. 我有一组XSD(A和B),它们对应的Java类是由maven-jaxb2-plugin生成的。 Java classes are in package P1. Java类位于程序包P1中。
Beside, I have a WSDL which uses some types from XSD A and B. 另外,我有一个WSDL,它使用XSD A和B中的某些类型。
However, when I generate Java classes from my WSDL with cxf-codegen-plugin, it generates types in package P2. 但是,当我使用cxf-codegen-plugin从WSDL生成Java类时,它将在程序包P2中生成类型。
==> Types in P1 and P2 are strictly identicals. ==> P1和P2中的类型严格相同。
My question is: how can I tell cxf-codegen-plugin to use existing package P1? 我的问题是:如何告诉cxf-codegen-plugin使用现有的软件包P1?
Thanks! 谢谢!
Hejk 赫克
If you take a look on the part where I specified packages you will find out two configurations. 如果您看一下我指定软件包的那一部分,您会发现两种配置。 The first one is: 第一个是:
<packagename>http://www.schema.org/something=info.package.p1</packagename>
During compiling xsd to java classes all files that have schema http://www.schema.org/something will be stored into the info.package.p1 package. 在将xsd编译为java类的过程中,所有具有模式http://www.schema.org/something的文件都将存储在info.package.p1包中。 The second configuration serves if xsd files do not belong to the first schema they will be stored into default package info.package.p2 . 如果xsd文件不属于第一个架构,则使用第二种配置,它们将存储在默认包info.package.p2中 。 You can make this configuration separately for each of your schema. 您可以为每个架构分别进行此配置。
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>3.1.7</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>src/main/java</sourceRoot>
<wsdlRoot>${basedir}/src/main/resources/wsdl/</wsdlRoot>
<includes>
<include>*your.wsdl</include>
</includes>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/wsdl/your.wsdl</wsdl>
<packagenames>
<packagename>http://www.schema.org/something=info.package.p1</packagename>
<packagename>info.package.p2</packagename>
</packagenames>
<bindingFiles>
<bindingFile>${basedir}/src/main/resources/bindingFile.xjb</bindingFile>
</bindingFiles>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.