Question

I have multiple bindings(xjb files) in the gradle project. When generating JAXB classes for a xsd(C.xsd). I want to use the previously generated binding files for A.xjb & B.xjb since C.xsd refers to A.xsd & B.xsd

The below ant xjc task works if I don't have anyother bindings in same path but I want specify explicity A.xjb & B.xjb bindings. How to go about same, I tried various options but nothing seems working. Any help greatly appreciated.

ant.xjc(destdir : '${jaxbDest}', removeOldOutput:'yes', extension:'true') {
  arg(line:'-Xequals -XhashCode -XtoString -Xcopyable')

  schema(dir:'src/main/schema', includes:'C.xsd')
  binding(dir:'src/main/schema', includes:'*.xjb)

}

Thanks Ravi

Was it helpful?

Solution

According to this documentation for the ant xjc task -

"To specify more than one external binding file at the same time, use a nested element, which has the same syntax as fileset."

In gradle it would look like this:

 binding(dir:'src/main/schema'){
    include(name:'A.xjb')
    include(name:'B.xjb')
 }

I think this would also work:

binding(dir:'src/main/schema', includes:'A.xjb,B.xjb')
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top