Ant 构建工具入门与核心概念解析
1. 获取项目信息
在使用 Ant 构建工具时, -projecthelp 选项能列出项目中的主要目标,这在你想了解构建文件提供了哪些目标时非常有用。Ant 只会列出包含可选描述属性的目标,因为这些目标是供公共使用的。
例如,执行以下命令:
>ant -projecthelp
Buildfile: build.xml
Main targets:
Subtargets:
archive
clean
compile
execute
init
Default target: archive
这个输出信息不太详细,原因是我们没有对构建文件进行充分的文档化。如果为每个目标添加描述属性,例如为 compile 目标添加 description="Compiles the source code" ,并在项目声明后添加 <description> 标签,那么目标列表将包含这些描述,标记所有有描述的目标为“主要目标”,并隐藏所有子目标:
Buildfile: build.xml
Compiles and runs a simple program
Main targets:
archive Creates the JAR file
clean Removes the temporary directories
超级会员免费看
订阅专栏 解锁全文
1121

被折叠的 条评论
为什么被折叠?



