《Ant权威指南》笔记(一)
http://www.cnblogs.com/pixy/p/4792887.html
创建一个用于编译和打包Java项目的配置文件build.xml(名字可以随便起,如mybuild.xml,执行的时候用-f 选项指定这个文件就可以):
<?xml version="1.0" encoding="UTF-8" ?> <project name="AntDemo" default="compile" basedir="."> <property name="src.dir" value="src" /> <property name="build.dir" value="build" /> <property name="build.classes" value="${build.dir}/classes" /> <property name="build.lib" value="${build.dir}/lib"/> <target name="prepare" description="create the build directories prior to the comile target"> <mkdir dir="${build.dir}" /> <mkdir dir="${build.classes}" /> <mkdir dir="${build.lib}" /> </target> <target name="clean" description="removes all generated files"> <delete dir="${build.dir}" /> </target> <target name="compile" depends="prepare" description="compiles all source code"> <javac srcdir="${src.dir}" destdir="${build.classes}" /> </target> <target name="jar" depends="compile" description="generates jar file "> <jar jarfile="${build.lib}/antDemo.jar" basedir="${build.classes}" excludes="**/*Test.class"/> </target> <target name="all" depends="clean, jar" description="clean, compile, generate jar file"/> </project>