I am hoping someone is on Gradle Community that ca...
# declarative-gradle
r
I am hoping someone is on Gradle Community that can help me get this finished up. I am attempting to convert XSD to JAVA files. I am unsure what I have wrong here.
// 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.
v
Please don't cross-post to multiple channels, that wastes the time of anyone reading the message multiple times and splits discussions. Pick one appropriate channel according to name and subject and at most post a link in other channels if you really feel you need more attention. Besides that it also is just a partly copy of an active forum thread. And in this channel, your message is absolutely off-topic as it has nothing at all to do with the Declarative Gradle project.
💯 1