Ant打包

build.xml文件

<?xml version="1.0" encoding="UTF-8" ?>
<project name="Design_Pattern" default="run" basedir=".">
<property name="src" value="CY"/>
<property name="dest" value="classes"/>
<property name="hello_jar" value="hello1.jar"/>
<target name="init">
<mkdir dir="${dest}"/>
</target>
<target name="compile" depends="init">
<javac srcdir="${src}" destdir="${dest}"/>
</target>
<target name="build" depends="compile">
<jar jarfile="${hello_jar}" basedir="${dest}"/>
</target>
<target name="run" depends="build">
<java classname="com.test.TestAnt" classpath="${hello_jar}"/>
</target>

<target name="clean">
<delete dir="${dest}"/>
<delete file="${hello_jar}"/>
</target>
<target name="return" depends="clean,run">
<ant target="clean"/>
<ant target="run"/>
</target>
</project>

建CY文件,DOS运行到build.xml所在目录,运行ant命令

你可能感兴趣的:(xml,ant,dos)