Reputation: 15716
IntelliJ IDEA 2022.1.3 (Community Edition
In my java project I use Ant to build project. To generate java files from wsdl file I use this Ant's target:
<!-- CXF -->
<property name="cxf.home" location="c:/Programs/apache-cxf-3.1.7" />
<path id="cxf.classpath">
<fileset dir="${cxf.home}/lib">
<include name="*.jar" />
</fileset>
</path>
<target name="cxfWSDLToJava">
<java classname="org.apache.cxf.tools.wsdlto.WSDLToJava" fork="true">
<arg value="-client" />
<arg value="-d" />
<arg value="src" />
<arg value="c:\temp\wsdl\Sign.wsdl.xml" />
<classpath>
<path refid="cxf.classpath" />
</classpath>
</java>
</target>
It's work fine.
But I want to migrate to Gradle. And the question is:
How I can generate java files from wsdl file by Gradle?
Upvotes: 0
Views: 2804
Reputation: 23042
You can use CXF Codegen Gradle to do this since you are already using org.apache.cxf.tools.wsdlto.WSDLToJava
. The plugin provides a DSL over the CLI options of the tool.
Minimum example:
tasks.register("sign", io.mateo.cxf.codegen.wsdl2java.Wsdl2Java::class) {
toolOptions {
wsdl.set(file("path/to/Sign.wsdl"))
}
}
See the docs for full list of supported options.
Note: I am the author of the plugin.
Upvotes: 1