我们将 Jaxb 与包含一些公共部分的不同模式文件一起使用。为了构建它,我们使用来自 JAXB 发行版的 Ant XJCTask:
<xjc classpath="bin" removeOldOutput="yes" schema="main-schema.xsd" target="src" extension="true">
<arg value="-no-header"/>
<depends dir=".">
<filename name="some/dir/included1.xsd"/>
</depends>
<produces dir=".">
<include name="some/package/dir/*.java"/>
</produces>
</xjc>
但显然依赖没有影响,因为可以看到运行 ant -verbose:
[xjc] Checking timestamp of /local0/mginkel/workspace/main-schema.xsd
[xjc] Checking timestamp of /local0/mginkel/workspace/some/package/dir/Generated1.java
[xjc] Checking timestamp of /local0/mginkel/workspace/some/package/dir/Generated2.java
有没有办法在 ant.properties 中正确跟踪对包含的依赖项。我只想在必要时重新编译绑定,但如果其中一个包含已更改,我肯定想重新编译。(这是目前不起作用的)。