1. Download: Go to the ant official website http://ant.apache.org/to download the latest version.
2. Configure environment variables: My computer ---- properties ----- advanced ---- Environment Variables
For example, ant_home: C: \ apache-ant-1.7.1
Path: % ant_home % \ bin (to facilitate operations in the DOS environment)
3. Check whether the installation is successful: Enter the ant command in the DOS window. If the result is displayed
Buildfile: Build. XML does not exist!
Build failed
It indicates that ant has been installed successfully! Because ant runs the build. xml file by default, this file needs to be created.
4. Usage:
(1) Create build. xml1 in the root directory of drive d <? XML version = "1.0" encoding = "GBK"?>
2 <project
Name = "test script" default = "copyfile" basedir = "."
>
3 <target name = "copyfile">
4 <copy file = "D:/a.txt" todir = "E:/Temp"
Overwrite = "true"
/>
5 </Target>
6 </Project>
(2) Create the.txt file under the d directory.
(3) Enter dos,
D:
Ant
In this case, the aa.txt file can be found in the E:/tempvisual directory. The content is the same as a.txt, that is, the file is copied successfully!