如何在 Ant 中获取构建目标列表? [英] How can I get a list of build targets in Ant?

查看:28
本文介绍了如何在 Ant 中获取构建目标列表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码库有一个很长的 build.properties 文件,由其他人编写.我想查看可用的构建目标,而无需手动搜索文件.ant 是否有这样的命令 - 类似于 ant show-targets - 让它列出构建文件中的所有目标?

My codebase has a long build.properties file written by someone else. I want to see the available built targets without having to search through the file manually. Does ant have a command for this - something like ant show-targets - that will make it list all the targets in the build file?

推荐答案

-p-projecthelp 选项正是这样做的,所以你可以试试:

The -p or -projecthelp option does exactly this, so you can just try:

ant -p build.xml

来自 ant 的命令行文档:

From ant's command line documentation:

-projecthelp 选项打印出构建文件的目标列表.包含 description 属性的目标列为主要目标",没有description 的目标列为其他目标",然后列出默认"目标(其他目标"仅在没有主要目标,或者以 -verbose-debug 模式调用 Ant 时显示).

The -projecthelp option prints out a list of the build file's targets. Targets that include a description attribute are listed as "Main targets", those without a description are listed as "Other targets", then the "Default" target is listed ("Other targets" are only displayed if there are no main targets, or if Ant is invoked in -verbose or -debug mode).

这篇关于如何在 Ant 中获取构建目标列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆