打印/访问当前正在执行的 Ant 目标的名称 [英] Print/Access the Name of the Currently Executing Ant Target
本文介绍了打印/访问当前正在执行的 Ant 目标的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在我的构建文件中执行此操作?说我只想
名字?
How do I do this within my build file? Say I just want to <echo/>
the name?
推荐答案
当前执行目标名称没有内置属性.一些争论在这里.
There is no built-in property for the current executing target name. Some debate on this is here.
如果像这样将 ant 与 log4j 配置为侦听器,输出将显示每个目标的开始和结束,如下所示.调用ant build
:
If you configure ant with log4j as a listener like this, the output will display each target start and end like below. Calling 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 目标的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文