gradle-xjc-plugin
gradle-xjc-plugin copied to clipboard
Migrate to 2.0.0
Hi, I'm using an old version of an gradle xjc plugin and had two tasks there in my build.gradle:
task xjcGenerateObjects1(type: XjcGenerateTask) {
source = fileTree('src/main/resources/proj1') { include '**/objects1.xsd' }
bindingFiles = fileTree('src/main/resources/proj1') { include '**/objects1.xjb' }
}
task xjcGenerateObjects2(type: XjcGenerateTask) {
source = fileTree('src/main/resources/proj2') { include '**/objects2.xsd' }
bindingFiles = fileTree('src/main/resources/proj2') {include '**/objects2.xjb' }
}
Now I migrated to Java 11 and gradle-xjc-plugin 2.0. How can I migrate above code? I tried following, but was not successful:
sourceSets {
main {
xjcSchema {
srcDir 'src/main/resources/proj1'
includes = ['objects1.xsd']
}
xjcBinding {
srcDir 'src/main/resources/proj1'
includes = ['objects1.xjb']
}
}
main2 {
xjcSchema {
srcDir 'src/main/resources/proj2'
includes = ['objects2.xsd']
}
xjcBinding {
srcDir 'src/main/resources/proj2'
includes = ['objects2.xjb']
}
}
}
@Carlfriedman did you ever figure this out? I had some code that looked very similar to yours to include wsdl files for the -wsdl parameter but can't seem to get verison 2 of the plugin to generate code from a wsdl.
FWIW, I got it to work just by setting srcDirName
to "resources". You don't have to mess with the sourcesets since the plugin already includes all xjb and xsd files. The relationship between srcDir
in the sourceset and the srcDirName
in the xjc config block is unclear.
xjc {
srcDirName = "resources"
}