Robert Dannelly
09/11/2024, 5:09 AM// Above in the build.gradle I have the following implementations, that are more, but did not include
// for brevity
implementation 'jakarta.xml.bind;jakarta.xml.bind-api:4.0.1'
implementation 'org.glassfish.jaxb:jaxb-runtime:2.3.8'
implementation 'org.glassfish.jaxb:codemodel:4.0.4'
implementation 'org.glassfish.jaxb:xsom:4.0.4'
implementation 'com.sun.activation:jakarta.activation:2.0.1'
// XJC tasks
// JAB2 configuration holds classpath for running the JAXB XJC compiler
configurations {
jaxb2
}
dependencies {
jaxb2 "org.glassfish.jaxb:jaxb-xjc:4.0.4"
}
def addXjcTask(taskName, schema pkg, dest) {
file(dest).mkdirs()
// The main XJC task, calls jaxb2
task generateCode {
def output = layoutbuildDirectory.dir('generated-sources')
outputs.dir(output)
doLast {
File sourcDir = outputget().asFile
}
}
tasks.create(name: taskName, type: JavaExec){
classpath configurations.jaxb2
mainClass = 'com.sun.tools.xjc.XJCFacade'
// To explore available args download the xjc JAR manually and run java -jar jaxb-xjc.jar --help
agrs schema, "-p", pkg, "-d", dest
}
// add a dependency on the new task so it get invoked
tasks.register("convert" {
dependsOn tasks getByName(taskName)
}
}
addXjcTask("xjc-upo",
"${project.rootDir}/src/main/resources/xsd/upo/file.xsd",
"com.company.xsd.upo.12345",
"${project.rootDir}/src/main/java/"
)
Does not seem to be working. Would like to understand what I am missing.Vampire
09/11/2024, 9:16 AM