ant - 打印/访问当前正在执行的 Ant 目标的名称

标签 ant

这个问题在这里已经有了答案:





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/

相关文章:

java - BuildLabel属性是如何生成的?

Ant结合两个refid作为类路径

java - Ant:文件集 "dir"属性,带有运行时扩展的完整路径

java - buildFinished 和 buildStarted 将不起作用

ant - Ant 如何将从文件中读取的值转换为属性值?

bash - build.xml 文件中的 cd 命令

java - 如何在每次部署我的 JSP 应用程序时自动执行一些代码

java - 在 WebSphere 6.1 上使用 ant/jenkins 生成 EAR 的类转换异常

list - Ant 中使用列表的并行作业

maven-2 - Ant、Maven 和 Jdeveloper SOA 扩展