在ant安装目录的manual目录是ant的说明文档,打开index.xml,点击Using Apache ant有使用说明。
相关命令说明
指定配置文件
执行ant命令,默认使用当前目录下的build.xml,可以通过-f指定配置文件。
示例:ant -f 配置文件路径
project
属性:
name:工程名称
default:默认执行的target
target
<target>是一个容器,指令集合,一个事务。
属性:
depends:依赖项,执行该target之前需要先执行的target。
name:名称
例子:
<target name="A" >
<target name="B" depends="A">
<target name="C" depends="A,B">
在命令行中执行指定target:ant targetName
property
ant中的属性,相当于定义一个变量,通过${属性名}引用。
属性:
name:变量名
value:值
file:属性配置文件路径,配置文件中要以key=value的格式配置属性。例子:
<property file="local.properties" />
environment:给环境变量起一个别名
例子:
<property name="a" value="aaa" />
<target name="print">
<echo>${a}</echo>
</target>