1 什么是ant
构建java工程,驱动build.xml文件中描述的过程,以及解析这些过程(编译,运行,打包)之间的依赖关系。默认build.xml
2 ant的元素:
project元素:根元素
target 元素:作为一个执行单元对应着ant XXX 命令,不同的taget做不同的事情,彼此之间存在依赖关系
property 元素 :对脚本内部元素和变量的定义
3 举个例子
<? xml version="1.0" ?>
<project name ="propertyPro" default ="example">
<property name ="name" value ="philander"/>
<property name ="age" value ="25"/>
<target name ="example">
<echo message ="name: ${name}, age: ${age}"/>
</target>
</project>
4 target执行单元 当中用到的命令:
<copy file="original.txt" tofile="copied.txt"/>
<delete file="/home/photos/philander.jpg"/>
<mkdir dir="/home/philander/build/classes"/>
<move file="sourcefile" tofile=”destfile”/>
<echo message="Hello,ANT" file="/home/philander/logs/ant.log" append="true">