??????????????????????
????build.xml?????????£?

 

<?xml  version="1.0"?>
<project name="tasks" default="main">
<property name="build.dir" location="build" />
<target name="init">
<mkdir dir="${build.dir}" />
</target>
<target name="compile" depends="init">
<javac srcdir="src" destdir="${build.dir}" />
</target>
<target name="simpletask" depends="compile">
<taskdef name="simpletask" classname="com.ant.test02.FileSorter" classpath="${build.dir}" />
<simpletask srcFile="input.txt" destFile="output.txt"/>
</target>
<target name="clean">
<delete dir="${build.dir}" />
</target>
<target name="main" depends="simpletask" />
</project>

????input.txt???????????????????????build.xml????output.txt???????????????????
???????2???????
??????????????????????磬??src*/*.java??????src?????κ????е?????Java?????
???????????????????**????????????????????????磬??**/*.java???????????μ?????Java???

 

<copy todir=”archive”>
<fileset dir=”src”>
<include name=”*.java”/>
</fileset>
</copy>

????fileset???????°??????src???μ????????????????????Java??????????????????include???????????????????????????????exclude??????????????include???????????????????????include??exclude????????????????????????????????include??????????????????????????exclude????????????

 

<?xml  version="1.0"?>
<project name="tasks" default="main">
<property name="build.dir" location="build" />
<target name="main" >
<copy todir="${build.dir}/dest_dir">
<!-- ?????build???μ?????????????μ???????????? -->
<fileset dir="${build.dir}">
<include name="*.class"/>
<exclude name="*.war"/>
</fileset>
</copy>
</target>
</project>