请任何人向我解释为什么会这样?我一直在使用 Maven,并且缺少 Ant 构建脚本的 xml 定义,这让我不得不通过 Internet 和文档进行搜索,而不是只查看 xsd 或 DTD。
例如,几乎不可能找出目标定义是否可以声明自己的属性。
最佳答案
有一个FAQ for this :
Is there a DTD that I can use to validate my build files?
An incomplete DTD can be created by the
<antstructure>
task - but this one has a few problems:
- It doesn't know about required attributes. Only manual tweaking of this file can help here.
- It is not complete - if you add new tasks via
<taskdef>
it won't know about it. See this page by Michel Casabianca for a solution to this problem. Note that the DTD you can download at this page is based on Apache Ant 0.3.1.- It may even be an invalid DTD. As Ant allows tasks writers to define arbitrary elements, name collisions will happen quite frequently - if your version of Ant contains the optional
<test>
and<junit>
tasks, there are two XML elements named test (the task and the nested child element of<junit>
) with different attribute lists. This problem cannot be solved; DTDs don't give a syntax rich enough to support this.
关于ant - 为什么没有用于构建脚本的 Apache Ant xml 模式定义或 DTD?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4417458/