比较常用的一个ant文件,需要的从这里下载
0: <?xml version="1.0"?> 1: <!-- 2: @author:火守 3: @email:34298824@qq.com 4: --> 5: <project name="shell Application" basedir="." default="all"> 6: <target name="init"> 7: <property name="desc" value="timer http Application" /> 8: <!-- set you jar -file-name --> 9: <property name="jar-name" value="ant-blank" /> 10: <property name="src.dir" value="src" /> 11: <property name="lib.dir" value="lib" /> 12: <property name="bin.dir" value="bin" /> 13: </target> 14: <target name="classpath"> 15: <path id="local.class.path"> 16: <fileset dir="${src.dir}/lib" includes="*.jar" /> 17: </path> 18: </target> 19: <target name="clean"> 20: <delete dir="${bin.dir}" /> 21: </target> 22: <target name="prepare"> 23: <mkdir dir="${bin.dir}/classes" /> 24: <mkdir dir="${bin.dir}/lib" /> 25: </target> 26: <target name="prepare-docs" depends="init"> 27: <mkdir dir="${bin.dir}/javadocs" /> 28: </target> 29: <target name="classes" depends="prepare,classpath,init"> 30: <javac debug="on" deprecation="on" destdir="${bin.dir}/classes"> 31: <classpath> 32: <path refid="local.class.path" /> 33: </classpath> 34: <src path="${src.dir}" /> 35: </javac> 36: <copy todir="${bin.dir}"> 37: <fileset dir="${src.dir}" includes="**/*.properties,**/*.xml,**/*.bat" /> 38: </copy> 39: <copy todir="${bin.dir}/lib"> 40: <fileset dir="${src.dir}/lib" includes="**/*.jar" /> 41: </copy> 42: </target> 43: <target name="jar" depends="classes"> 44: <jar jarfile="${bin.dir}/${jar-name}.jar" basedir="${bin.dir}/classes" /> 45: </target> 46: <target name="docs" depends="prepare-docs,classpath"> 47: <!-- set you package-name --> 48: <javadoc packagenames="com.smz.http.*" classpathref="local.class.path" destdir="${bin.dir}/javadocs"> 49: <sourcepath path="${src.dir}" /> 50: </javadoc> 51: </target> 52: <target name="all" depends="init,jar,docs" /> 53: </project>