Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to specify multiple binding files in gradle for ant xjc task

Tags:

gradle

ant

xjc

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

like image 809
ravi Avatar asked Mar 23 '23 08:03

ravi


1 Answers

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')
like image 68
Becca Gaspard Avatar answered Mar 29 '23 04:03

Becca Gaspard