问题描述
我在 gradle 项目中有多个绑定(xjb 文件).为 xsd(C.xsd) 生成 JAXB 类时.我想将之前生成的绑定文件用于 A.xjb &B.xjb 因为 C.xsd 指的是 A.xsd &B.xsd
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
如果我在同一路径中没有任何其他绑定但我想明确指定 A.xjb &B.xjb 绑定.如何去做,我尝试了各种选择,但似乎没有任何效果.非常感谢任何帮助.
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)
}
谢谢拉维
推荐答案
根据 本文档用于 ant xjc 任务 -
According to this documentation for the ant xjc task -
要同时指定多个外部绑定文件,请使用嵌套元素,其语法与文件集相同."
在 gradle 中它看起来像这样:
In gradle it would look like this:
binding(dir:'src/main/schema'){
include(name:'A.xjb')
include(name:'B.xjb')
}
我认为这也行:
binding(dir:'src/main/schema', includes:'A.xjb,B.xjb')
这篇关于如何在 gradle 中为 ant xjc 任务指定多个绑定文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!