我想将我的 Maven2 构建文件切换到 gradle。似乎没有进一步记录使用 gradle 从 WSDL + XSD 生成 java 类,没有为此的 gradle 插件。我将以下配置与 maven 一起使用,并搜索 gradle 的等效项。
<!-- plugin for generating the classes from the WSDL+XSD -->
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>0.7.3</version>
<executions>
<execution>
<id>app1-stub-generation</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaDirectory>${project.build.directory}/wsdl/app1</schemaDirectory>
<schemaIncludes>
<include>*.xsd</include>
</schemaIncludes>
<generatePackage>org.app1.ws.generated</generatePackage>
<generateDirectory>${project.build.directory}/generated-sources/app1</generateDirectory>
<strict>true</strict>
</configuration>
</execution>
<execution>
<id>app2-v1-stub-generation</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaDirectory>src/main/resources/wsdl</schemaDirectory>
<schemaIncludes>
<include>v1/*.xsd</include>
</schemaIncludes>
<generatePackage>org.app2.ws.generated.v1</generatePackage>
<generateDirectory>${project.build.directory}/generated-sources/v1</generateDirectory>
<strict>true</strict>
</configuration>
</execution>
<execution>
<id>app2-v2-stub-generation</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<schemaDirectory>src/main/resources/wsdl</schemaDirectory>
<schemaIncludes>
<include>v2/*.xsd</include>
</schemaIncludes>
<generatePackage>org.app2.ws.generated.v2</generatePackage>
<generateDirectory>${project.build.directory}/generated-sources/v2</generateDirectory>
<strict>true</strict>
</configuration>
</execution>
</executions>
</plugin>