【问题标题】:Is there a way to expand an ant property inside a target description?有没有办法在目标描述中扩展 ant 属性?
【发布时间】:2015-08-15 18:04:25
【问题描述】:

是否可以让 ant 帮助使用目标描述中的属性值?仅使用 ${} 符号似乎不起作用

构建文件:

<property name="test.report.dir"           value="report"/>
...
<target name="test" depends="compile.main, compile.test" description="Runs unit tests. Reports are saved in ${test.report.dir}/">
...

终端:

ant -p

Buildfile: /home/aaron/Projects/DataStore/build.xml

Main targets:
...
 test                   Runs unit tests. Reports are saved in ${test.report.dir}/
...

这是 Echo target description in Ant 中建议的解决方案,但正如评论者指出的那样,它不会扩展属性。

我在 Ubuntu 上使用 ant 1.9.3。

【问题讨论】:

    标签: ant


    【解决方案1】:

    不,这是不可能的。按原样读取目标描述:不进行属性评估。这是有道理的,因为:

    • 目标描述应提供有关目标行为的一般信息,与特定属性的值无关。

    • 项目帮助-p 选项不执行构建文件中包含的 Ant 任务,因此它无法评估使用 property 任务定义的属性。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2010-09-08
      • 1970-01-01
      • 1970-01-01
      • 2010-09-24
      • 2011-11-06
      • 2021-08-25
      • 1970-01-01
      • 2017-03-10
      相关资源
      最近更新 更多