我想將我的Maven2構建文件切換爲gradle。 使用gradle從WSDL + XSD生成java類似乎沒有進一步說明,因爲沒有gradle插件。 我使用maven的以下配置並搜索相當於gradle。如何使用gradle生成來自WSDL和XSD的類,相當於maven-jaxb2-plugin
<!-- 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>
如果有人還在跟蹤這個,有沒有人試過JAXB擴展添加到這個?當我這樣做時,出現像「Provider xx not a subtype」這樣的錯誤,其中「xx」是擴展的主要插件類。 –