simple build.xml

the example is the Ant in Action book:

 

<?xml version="1.0" encoding="gb2312"?>
<project name="fistbuild" default="execute">
<description>Compiles ant runs a simple program</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>
 
  <target name="run" depends="compile"
     description="Runs the program">
 <java
     classname="test.Main"
     classpath="build/classes">
     <arg value="a"/>
     <arg value="b"/>
     <arg file="."/>
  </java>
  </target>
 
</project>

你可能感兴趣的:(ant,File,jar,delete,encoding,archive)