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 tools\apache-ant-1.9.2-bin\apache-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 tools\apache-ant-1.9.2-bin\apache-ant-1.9.2\bin.

3. open cmd, type ant, if it shows something like, Buildfile: E:\build.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.

posted @ 2013-10-29 01:33  丸子No1  阅读(227)  评论(0编辑  收藏  举报