How to run ant script

1. download from http://ant.apache.org/. This tool can be used to package code.

2. set path. right click my computer->properties->Advanced System Setting->variable path. Under Administrator,create new ANT_HOME variable setting its value as D:program toolsapache-ant-1.9.2-binapache-ant-1.9.2(here my path is like this, this path may change in your system). Under System, add following content at the end of path variable, %ANT_HOME%/bin or D:program toolsapache-ant-1.9.2-binapache-ant-1.9.2in.

3. open cmd, type ant, if it shows something like, Buildfile: E:uild.xml , then it means you install ant successfully.

3. To test ant further, create build.xml file under E:\, copy following inside, 

<?xml version="1.0" encoding="GBK"?>
<project name="test" default="copyfile" basedir=".">
    <target name="copyfile">
        <copy file="d:/origion.txt" todir="d:/tmp" overwrite="true"/>
    </target>
</project>

create a origion.txt, enter something randomly as u prefer.

under cmd, use E: command to enter into E:> , then run ant command. (Here by default ant will find build.xml automatically, if your file is not build.xml, you should use the command ant –f filename.xml instead).

Result will be like this,

BUILD SUCCESSFUL.

Congrats. You made it.

原文地址:https://www.cnblogs.com/songwanzi/p/3393538.html