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 gradle. Show all posts
Showing posts with label gradle. 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
Tuesday, April 3, 2012
Gradle + cobertura + sonar
At my current client we use gradle for building, so i thought I should give sonar+cobertura a go. Here is my config.
subprojects {
apply plugin: 'java'
apply plugin: 'sonar'
// add support for the cobertura task
def coberturaPluginBase = 'https://raw.github.com/valkolovos/gradle_cobertura/master/ivy'
apply from: "${coberturaPluginBase}/gradle_cobertura/gradle_cobertura/1.0-rc4/coberturainit.gradle"
// configure sonar to pick up the cobertura test-reports
sonar {
project {
coberturaReportPath = file('build/reports/cobertura/coverage.xml')
}
}
}
Now you can run cobertura and sonar with the command:
# gradle cobertura sonarAnalyze
You do need a running instance of sonar to make use of this. Download it here and configure the plugin like this.
Sources:
Sonar-plugin(1.0-m08)
http://gradle.org/docs/current/userguide/sonar_plugin.html
Cobertura-plugin(1.0-rc4)
https://github.com/valkolovos/gradle_cobertura
Location:
Lysaker, Bærum, Norge
Wednesday, October 19, 2011
Gradle remote debug for java
Type:
export GRADLE_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=y"
Run your gradle commands as normal and hook up on port 4000 to remote debug your app.
E.g. ./gradlew jettyRun
export GRADLE_OPTS="-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=y"
Run your gradle commands as normal and hook up on port 4000 to remote debug your app.
E.g. ./gradlew jettyRun
Subscribe to:
Posts (Atom)