这个问题在这里已经有了答案:
How can I get the value of the current target ant?
(5 个回答)
6年前关闭。
如何在我的构建文件中执行此操作?说我只想<echo/>
名字?
最佳答案
当前执行目标名称没有内置属性。一些争论 on this is here .
如果像这样将 ant 与 log4j 配置为监听器,输出将显示每个目标开始和结束,如下所示。调用 ant build
:
D:\apache-ant-1.8.0RC1\bin>ant -lib D:\log4j\log4j\1.2.13 -listener org.apache.tools.ant.listener.Log4jListener build
Buildfile: D:\apache-ant-1.8.0RC1\bin\build.xml
11:39:34 INFO Build started.
build:
11:39:34 INFO Target "build" started.
[echo] 100
11:39:34 INFO Updating property file: D:\abc.properties
[propertyfile] Updating property file: D:\abc.properties
11:39:35 INFO Target "build" finished.
BUILD SUCCESSFUL
Total time: 0 seconds
关于ant - 打印/访问当前正在执行的 Ant 目标的名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3084946/