3

I am using Ant files for build

The build itself is done by IBM Rational Team Concert (RTC) with the help of this Ant file.

My problem is that if I make a mistake in the build XML itself like wrongly typed attribute name, this itself is detected by RTC after loading the files from source control (normally 15-20 mins)

Is there a way to verify (validate) the Ant XML file itself?

4

2 回答 2

2

Ant XML 没有模式。如常见问题解答中所述,可以创建不完整的 DTD,但无法正常工作:

任务可以创建不完整的 DTD - 但是这个有一些问题:

  • 它不知道所需的属性。只有手动调整此文件才能提供帮助。
  • 它不完整 - 如果您通过它添加新任务将不会知道它。有关此问题的解决方案,请参阅 Michel Casabianca 的此页面。请注意,您可以在此页面下载的 DTD 基于 Apache Ant 0.3.1。
  • 它甚至可能是无效的 DTD。由于 Ant 允许任务编写者定义任意元素,名称冲突会经常发生 - 如果您的 Ant 版本包含可选和任务,则有两个名为 test 的 XML 元素(任务和嵌套的子元素)具有不同的属性列表。这个问题无法解决;DTD 没有提供足够丰富的语法来支持这一点。
于 2013-04-26T08:56:50.537 回答
0

同样,FAQ 指出 DTD 还没有(还?)强大到足以做到这一点,但我在 Ant Wiki 上的 AntDTD 页面上找到了基于 Michel Casabianca 的工作的 Ant 1.6 的初步工作。至于我,我不打算使用它。

于 2016-11-11T21:30:48.193 回答