我有两个生成 Java 文件的插件。一个从 WSDL 文件生成代码,另一个从 XSD 模式文件生成代码。仅生成模式中的代码。
如果每个插件都有单独的 Eclipse 项目,那么所有源代码都会正确生成。但是我想在一个项目中同时使用两个插件来生成代码。
这是我的pom文件:
<plugins>
<!-- generate Java classes from schema files (binding files optional) -->
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.8.2</version><!--$NO-MVN-MAN-VER$ -->
<executions>
<execution>
<id>xsd_phase</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<bindingDirectory>${project.basedir}/xsd/</bindingDirectory>
<schemaDirectory>${project.basedir}/xsd/</schemaDirectory>
<generateDirectory>${project.basedir}/target/src/generated/java/</generateDirectory>
<generatePackage>com.abc.xyz.jaxb</generatePackage>
<forceRegenerate>true</forceRegenerate>
<episode>false</episode>
<removeOldOutput>true</removeOldOutput>
</configuration>
</execution>
</executions>
</plugin>
<!-- generate Java classes from wsdl files -->
<plugin>
<groupId>org.jvnet.jax-ws-commons</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<id>wsdl_phase</id>
<phase>generate-sources</phase>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<encoding>UTF-8</encoding>
<packageName>com.abc.xyz.ws</packageName>
<wsdlDirectory>${project.basedir}/wsdl/</wsdlDirectory>
<sourceDestDir>${project.basedir}/target/src/generated/java/</sourceDestDir>
<xnocompile>false</xnocompile>
</configuration>
</execution>
</executions>
</plugin>