First, install Ant
Go to the official homepage http://ant.apache.org Download the new version (currently Ant1.8.1) ant, get a apache-ant-1.8.1-bin.zip compression package. Unzip it to your hard drive, for example: C:\apache-ant-1.8.1.
Second, configure environment variables
Setting 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
such as: ant_home:c:\apache-ant-1.8.1
Path:%ant_home%\bin (for ease of operation in DOS environment)
Experiment has always failed, no way to change the address c:/Apache-ant-1.8.1/bin, and no longer use the variable ... It worked..
】
Third, verify Ant
To verify that ant is installed successfully, you can do the following:
Select: Start-> run->cmd, enter the following command: Ant
If the following occurs, the installation is successful:
Copy Code code as follows:
Buildfile:build.xml does not exist!
Build failed
"Indicates that the ant installation was successful!" Because ant runs the Build.xml file by default, this file needs to be set up for us. 】
View version: Ant-version
However, if the following occurs, the installation fails: (You can repeat the preceding steps until the installation succeeds.) )
' Ant ' is not an internal or external command, it is not a running program or a batch file.
Moving over from elsewhere:
Use:
(1) Establishment of Build.xml in D-Packing directory
Copy Code code as follows:
<?xml version= "1.0" encoding= "GBK"?>
<project name= "test Script" default= "CopyFile" basedir= "." >
<target name= "CopyFile" >
<copy file= "D:/a.txt" todir= "E:/temp" overwrite= "true"/>
</target>
</project>
(2) Establish the file A.txt in the D packing directory.
(3) Enter DOS,
D:
Ant
At this point in the E:/temp directory to see the file Aa.txt, content and a.txt the same, that is, copy success!