ant击jar包的xml示例
<project name="wztTest" default="dist" basedir=".">
<description>
simple example build file
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="bin" location="bin"/>
<property name="dist" location="dist"/>
<!-- 引用用到的jar -->
<path id="classpath">
<fileset dir="lib">
<include name="*.jar"/>
</fileset>
</path>
<target name="init">
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init" description="compile the source " >
<!-- 这里拷贝bin目录下所有文件,目的是将除class之外的文件都拷贝(因为打jar包时ant只会拷贝class文件),如xml文件,properties文件等 -->
<copy todir="${build}">
<fileset dir="${bin}">
</fileset>
</copy>
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}">
<classpath refid="classpath"/>
</javac>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
<jar jarfile="wztTest.jar" basedir="${build}"/>
</target>
<target name="clean" description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
</target>
</project>