In one of my earlier posts, I described how you can use gradle to generate java source-code from wsdls. This included writing your own tasks, managing dependency etc.
Now, I have written a plugin for this, available at the gradle plugin portal. Go fetch it while it's fresh!
Gradle plugin portal: http://plugins.gradle.org/plugin/no.nils.wsdl2java
How to use the plugin: https://github.com/nilsmagnus/wsdl2java/blob/master/README.md
If you have any issues, please register them at https://github.com/nilsmagnus/wsdl2java/issues
Showing posts with label cxf. Show all posts
Showing posts with label cxf. Show all posts
Monday, September 22, 2014
Saturday, February 16, 2013
Generate java from Wsdl with gradle
UPDATE: I have made a plugin to do this, just follow the guide on https://github.com/nilsmagnus/wsdl2java .
The plain simple way to generate java from wsdl is this: add a javaexec task to your wsdl and run. The following code snippet will help you out:
The plain simple way to generate java from wsdl is this: add a javaexec task to your wsdl and run. The following code snippet will help you out:
The "wsdlsToGenerate" contains all the arguments for the org.apache.cxf.tools.wsdlto.WsdlToJava class, in the right order.
However, if you have a project like I have with 58 different wsdls, this approach is very time consuming. This is because every time createJavaFromWsdl() is called, a new java process will be started, executed and stopped. Now you have 58 sequential java processes running in your build script(!).
Instead, why not run everything in the same java process? This can be done with code snippet 2:
Now, this adds some dependencies to the build-script, but I can live with that.
The runtime from snippet1 with 58 wsdls is 2min 58secons on my laptop. The runtime of snippet2 is 24seconds!
Labels:
buildscript,
cxf,
gradle,
java,
wsdl2java,
wsdltojava
Subscribe to:
Posts (Atom)