<?xml version="1.0"?>
<project name="test" default="package">
<target name="init">
<mkdir dir="build/classes"/>
<mkdir dir="dist"/>
</target>
<target name="compile" depends="init" description="compile java code">
<javac srcdir="src" destdir="build/classes"/>
</target>
<target name="package" depends="compile" description="generate jar files">
<jar destfile="dist/test.jar" basedir="build/classes"/>
</target>
<target name="clean" description="delete generated directories">
<delete dir="build"/>
<delete dir="dist"/>
</target>
</project>
转载于:https://www.cnblogs.com/macula7/archive/2010/06/05/1960424.html