I have a Java project that depends on a set of JAXB generated classes from a set of enterprise XML schemas. I have been using XJC through the command line to generate my JAXB classes up to this point, but I am now trying to integrate my xjc command into my eclipse java project using buildship. I deleted out my JAXB classes and attempted to rebuild my java project through the eclipse gradle interface. My problem is that my java keeps trying to compile before it rebuilds my JAXB classes, and that just spits out compilation errors and abends. I tried to use a JAXB plugin and now i am just trying to call out using a Groovy call in Gradle, but no luck.
Now, my GenerateJaxb task may be malformed, but I can't even get execution to get that far, so I haven't been able to test it yet!
Here is my build.gradle code:
//apply your plugins
plugins {
id "java"
}
repositories {
jcenter()
}
dependencies {
// The production code uses the SLF4J logging API at compile time
compile 'org.slf4j:slf4j-api:1.7.21'
// log4j
compile 'log4j:log4j:1.2.17'
// google guava library
compile 'com.google.guava:guava:r05'
// Declare the dependency for your favourite test framework you want to use in your tests.
// TestNG is also supported by the Gradle Test task. Just change the
// testCompile dependency to testCompile 'org.testng:testng:6.8.1' and add
// 'test.useTestNG()' to your build script.
testCompile 'junit:junit:4.12'
}
task GenerateJaxb(type:Exec){
workingDir 'C:\\Program Files\\Java\\jdk1.8.0_73\\bin'
commandLine 'xjc.exe -d C:\\SVN\\Tibco\\Java\\branches\\SBC_Gradle\\src\\generated\\java C:\\SVN\\Tibco\\Projects\\HIPAA\\834\\trunk\\834Automation\\Schemas\\Canonical\\SBCCalculator2017.xsd -extension -p schema'
println "ran GenerateJaxb task"
}
Update: I was able to fix my task and now the build compiles to success, (fixed in source code above), but when I run the gradle build task it is not rebuilding my JAXB.