1. Install ant
Go to the official homepage http://ant.apache.org to download the new version (currently ant1.8.1release of ant, get a compressed package of apache-ant-1.8.1-bin.zip. Decompress it to your hard disk, for example, C: \ apache-ant-1.8.1.
2. Configure Environment Variables
Set ant environment variables in window:
Ant_home C:/Apache-ant-1.8.1
Path C:/Apache-ant-1.8.1/bin
Classpath C:/Apache-ant-1.8.1/lib
Note :【Configure environment variables: My computer ---- properties ----- advanced ---- Environment Variables
For example, ant_home: C: \ apache-ant-1.8.1
Path: % ant_home % \ bin (to facilitate operations in the DOS environment)The experiment always fails and cannot be changed to address C:/Apache-ant-1.8.1/bin without using variables... Yes ..]
3. Verify ant
To verify whether ant is successfully installed, perform the following operations:
Select Start> RUN> cmd, and enter the following command: ant
If the following content appears, the installation is successful:
Buildfile: Build. XML does not exist!
Build failed
[This indicates that ant has been installed successfully! Because ant runs the build. xml file by default, this file needs to be created .]
View version: ant-version
If the following content appears, the installation fails: (you can repeat the preceding steps until the installation is successful .)
'Ant'It is neither an internal or external command, nor an executableProgramOr batch files.
Move from somewhere else:
Usage:
(1) Create build. xml under the root directory of drive d
1 <? 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 ddisk root directory.
(3) Go to dos.
D:
ant
the aa.txt file can be found in the E:/tempdirectory. The file contains the same content as a.txt, which means the copy is successful!