<project name="MyProject" default="dist" basedir=".">
<property name="src" value="."/>
<property name="build" value="build"/>
<property name="dist" value="dist"/>
<property name="class.dir" value="lib"/>
<!--设置编绎路径-->
<path id="classpath">
<pathelement location="${classpath.dir}"/>
<fileset dir="${classpath.dir}" includes="**/*.jar"/>
</classpath>
<!--创建文件-->
<target name="init">
<mkdir dir="${build}"/>
</target>
<!--表示compile依赖init,编绎java文件-->
<target name="compile" depends="init">
<javac srcdir="${src}" destdir="${build}">
<classpath refif="classpath">
</javac>
</target>
<!--打jar架包-->
<target name="dist" depends="compile">
<mkdir dir="${dist}/lib"/>
<jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar"/>
</target>
<!---删除文件夹->
<target name="clean">
<delete dir="${build}"/>
<delete dir="${dist}"/>
</target>
</project>
Ant简介
最新推荐文章于 2023-10-26 19:58:47 发布