Last active
September 3, 2024 04:30
-
-
Save nilsmagnus/4965930 to your computer and use it in GitHub Desktop.
Fast wsdl2java with gradle and many wsdl files.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
buildscript { | |
repositories { | |
mavenCentral() | |
} | |
} | |
project.ext { | |
wsdlDir = file("wsdl") | |
generatedWsdlDir = file("build/generated-sources") | |
wsdlsToGenerate = [ | |
['-xjc', '-b', "$wsdlDir/serializable_binding.xml", "$wsdlDir/mywsdl2.wsdl.xml"], | |
['-xjc', '-b', "$wsdlDir/some_binding.xml", "$wsdlDir/mywsdl3.wsdl.xml"], | |
['-xjc', '-b', "$wsdlDir/other_binding.xml", "$wsdlDir/mywsdl4.wsdl.xml"], | |
// 54 more wsdls | |
['-xjc', '-b', "$wsdlDir/joda_binding.xml", "$wsdlDir/mywsdl55.wsdl.xml"], | |
] | |
} | |
configurations{ | |
ws | |
} | |
dependencies{ | |
ws "org.apache.cxf:cxf-tools:2.5.1", | |
"org.apache.cxf:cxf-tools-wsdlto-databinding-jaxb:2.5.1", | |
"org.apache.cxf:cxf-tools-wsdlto-frontend-jaxws:2.5.1", | |
"log4j:log4j:1.2.17" | |
} | |
task wsdl2Java() { | |
if (!wsdlDir.listFiles()) { | |
// do nothing | |
} else { | |
inputs.files wsdlDir.listFiles() | |
outputs.files generatedWsdlDir | |
doLast { | |
wsdlsToGenerate.each { argsin -> | |
argsin.add(argsin.size - 1, '-d') | |
argsin.add(argsin.size - 1, generatedWsdlDir) | |
javaexec { | |
classpath configurations.ws | |
main = 'org.apache.cxf.tools.wsdlto.WSDLToJava' | |
args = argsin | |
systemProperties = ['exitOnFinish':'TRUE'] | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment