ant - 为什么没有用于构建脚本的 Apache Ant xml 模式定义或 DTD?

标签 ant

请任何人向我解释为什么会这样?我一直在使用 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/

相关文章:

java - Gradle:从自定义任务中调用 ant

ant - 将文件复制并解压缩到远程计算机 - ant

Ant 的可选任务在 CentOS 上不可用

xml - Ant 用特殊字符替换文本

java - Ant 脚本示例

Ant 无法识别其 lib 目录中的 JUnit jar?

ant - 有没有办法在 ANT 中生成 guid?

java - Eclipse 默认构建和 ant 构建

ant - gradle什么时候以及如何解决其依赖关系?

java - 在 shell 脚本中调用连续的 java 任务