) 设置ANT_HOME环境变量指向你的ANT目录
) 需要设置JAVA_HOME环境变量指向你的JDK目录
) 将%ANT_HOME%\bin加入到PATH环境变量中
) 当你不带任何参数运行ant时Ant会在当前目录找一个名叫buildxml的文件如果没找到会有以下提示
Buildfile : buildxml does not exist!Build failed
为了测试ANT安装是否成功我建立了一个新的buildxml文件放在当前的目录下%ANT_HOME%\samplesBuildxml内容如下
<! Simple Ant build script to test an Ant installation ><br />
<project name=TestInstall default=run basedir=><br />
<target name=init> <br />
<available file=ASimpleHelloObjectjava property=ASimpleHelloObject/> <br />
</target> <br />
<target name=ASimpleHelloObject unless=ASimpleHelloObject depends=init> <br />
<echo file=ASimpleHelloObjectjava><br />
public class ASimpleHelloObject<br />
{<br />
public static void main(String[] args) { <br />
Systemoutprintln(ASimpleHelloObjectmain was called); }<br />
}<br />
</echo> <br />
<echo message=Wrote ASimpleHelloObjectjava /> <br />
</target> <br />
<target name=compile depends=ASimpleHelloObject> <br />
<javac destdir= srcdir= debug=on classpath=> <br />
<include name=ASimpleHelloObjectjava/> <br />
</javac> <br />
</target> <br />
<target name=run depends=compile> <br />
<java classname=ASimpleHelloObject classpath= /> <br />
<echo message=Ant appears to be successfully installed /> <br />
</target><br />
</project><br />
[] [] [] [] [] [] [] []