xml 代码
- xml version="1.0" ?>
- <project name="structured" default="archive">
- <description>Compiles and Achive [build/class] [dist]description>
- <target name="init">
- <mkdir dir="build/classes" />
- <mkdir dir="dist" />
- target>
- <target name="compile" depends="init"
- description="Compiles the source code">
- <javac srcdir="src" destdir="build/classes" />
- target>
- <target name="archive" depends="compile"
- description="Creates the JAR file">
- <jar destfile="dist/project.jar" basedir="build/classes" />
- target>
- <target name="clean" depends="init"
- description="Removes the temporary directories used">
- <delete dir="build" />
- <delete dir="dist" />
- target>
- project>
使用时,将你的java源文件按包的结构存放好(如:package myant.test; 应建立myant\test目录,并将对应该包的源文件放在此目录),然后将本build.xml存放在一起,再运行ant.