http://blog.csdn.net/linwei_1029/article/details/5809801steps to run an ant script
1. Right-click My Computer--"Properties--" advanced--"environment variable--" administator User variable--"new (variable named ant_home, variable value is e:/java/ant/ apache-ant-1.6.5, that is, ant's installation root, not to bin)
2. Add a line to the path of the system variable%ant_home%/bin "= =" E:/java/ant/apache-ant-1.6.5/bin
3. Enter CMD in the run, then enter the cmd command line, and if the following statement appears, the ant installation is successful
Buildfile:build.xml does not exist!
Build failed
Example Description: * * * *
1. Create a build.xml in d:/that contains
<?xml version= "1.0" encoding= "GBK"?>
<project name= "test Script" default= "CopyFile" basedir= "." >
<target name= "CopyFile" >
<copy file= "D:/a.txt" todir= "C:/temp" overwrite= "true"/>
</target>
</project>
2. Create a a.txt in the same level directory
3. Go to cmd, use D: Enter the appropriate directory, and then enter Ant, if successful you can see data such as the following
Buildfile:build.xml
CopyFile
[Copy] Copying 1 file to C:/temp
BUILD Successful
Total time:0 seconds
4. Finally, in c:/, you can see that a temp directory was generated, and then there is a a.txt file
Attention:
1. Naming the build script
The default name is Build.xml, if your build script name is Build.xml, then you can run the ant command directly, if it is another name, such as: Mybuild.xml, then your command line should be changed to: Ant–f Mybuild.xml.
2. Run a specific task?
Run: Ant CopyFile, which will run the target named CopyFile.
Run the ant script (reprint)