<?xml version= "1.0"? ><project name= "HelloWorld" ><target name= "SayHelloWorld" ><echo message= " Hello,xutianhao "/></target></project><!--Ant_helloworld--
<?xml version= "1.0"? ><project name= "Projectstudy" default= "Saybasedir" basedir= "E:\apache-ant-1.8.2-bin\ apache-ant-1.8.2 "><!--default represents an action that is to be performed target--><!--basedir The property set for the user if it is removed and then executed, the result is e: The parent directory of the ant build file--><target name= "saybasedir" ><!--command line executes the statement Ant Saybasedir is the Saybasedir step--><!- -If you do not specify target direct ant will complete the default specified Target--><echo message= "the base dir is:${basedir}"/></target>< !--If you have two name of the same target in a project, run the result as build failede:\build.xml:20:duplicate target ' Saybasedir '--></project >
<?xml version= "1.0"? ><project name= "Targetstudy" ><target name= "Targeta" if= "Ant.java.version" > <!--if the If attribute exists, the target will be executed--><echo message= "Java.version:${ant.java.version}"/></target>< Target Name= "Targetb" unless= "Amigo" depends= "Targeta" ><!--if the unless attribute exists, the target will not be executed--><!-- TARGETB relies on Targeta--><!--run ant Targetb First perform targeta (dependent) and then execute TARGETB--><description>a depend example! </description><echo message= "The base dir is:${basedir}"/></target></project><!--run result E : \>ant Targetbbuildfile:e:\build.xmltargeta: [echo] Java.version:1.7targetb: [echo] the base dir is:e: BUILD successfultotal time:0 seconds--
<?xml version= "1.0"? ><project name= "Targetstudy" ><target name= "Targeta" ><echo message= "the Base dir is:${basedir} "/><!--the absolute path to the project base directory--><echo message=" the Ant.file Is:${ant.file} "/><!-- BuildFile absolute path--><echo message= "The Ant.java.version is:${ant.java.version}"/><!--ant detected Java version - -><echo message= "The Ant.version is:${ant.version}"/><!--ant version--><echo message= "the Ant.project.name is:${ant.project.name} "/><!--the name of the project currently being developed--></target></project><! --E:\>ant Targetabuildfile:e:\build.xmltargeta: [echo] the base dir is:e: [echo] the base dir is:e:\build.xm L [echo] the base dir is:1.7 [echo] the base dir is:apache Ant (TM) version 1.8.2 compiled on December [Echo] The base dir is:targetstudybuild successfultotal time:0 seconds--
<?xml version= "1.0"? ><project name= "Targetstudy" ><property name= "name" value= "Xutianhao"/>< Property Name= "Age" value= "/><target name=" Targeta "><echo message=" the base dir is:${name} "/> <!--Set the Name property Xutianhao--><echo message= "The base dir is:${age}"/>< set the Age attribute 23--></target> </project>
ant-Study Record One