????Ant??????????javac??java??jar???????????java????????????????????????Java?????????????????????????
????1.project???
????project?????Ant??????????????Ant?????????????e??????project????????????????????project????£?????????target????????????????????project??????????
????1??name????
???????????project?????????
????2??default????
???????????project???????????е?target???????
????3??basedir????
?????????????·????λ?á???????????????????Ant???????????????????????
????2.target???
???????Ant???????е????????????????????????????????target???????????????????????????????
????1??name????
???????target?????????????????????project??????????????????????target????????????????target??
????2??depends????
????????????target???????????????????target???????????????????“??”????Ant??????depends??????target??????????????????target??????????target??????С?
????3??if????
???????????????????????????????????????target????????С?
????4??unless????
????????????????if??????????????????????????????????????????????????????target??????С?
????5??description????
???????????????target??????????????????
????3.property???
????????????????????????????壬project????????????property??????趨???????Ant????趨???????????????????????build.properties???????????????????????????<property file=” build.properties”/>
????property????????task???????????task???????????????????“${”??“}”?????????task???????λ?????????
????Ant?????Щ??????????????????????????б???Java?????System.getPropertis()?????????????????
????????Ant???????Щ???????????????????£?
????basedir??project??????·???????????????project???????????????????????
????ant.file??buildfile??·?????????????????У?ant.file????E:"build.xml??
????ant.version??Ant??汾????????У???1.7.0??
????ant.project.name??????????project?????????????????project??name????????
????ant.java.version??Ant?????JDK??汾???????????н???п?????1.5??
??????????????????????
????1.????Ant??javac??????????java????
????????build.xml???????????£?

 

<?xml version="1.0"?>
<project name="javacTest" default="compile" basedir=".">
<target name="clean">
<delete dir="build"/>
</target>
<target name="compile" depends="clean">
<mkdir dir="build/classes"/>
<javac srcdir="src" destdir="build/classes"/>
</target>
</project>