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

拥有回忆 提交于 2019-12-23 15:27:59

问题


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


回答1:


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')


来源:https://stackoverflow.com/questions/18946818/how-to-specify-multiple-binding-files-in-gradle-for-ant-xjc-task

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!