1. 在控制台运行第一个build.xml时报错
The processing instruction must begin with the name of the target
原来是xml文件开头写成了
<? xml version="1.0" encoding="utf-8" ?>
<?后面多了一个空格
应该写成<?xml version="1.0" encoding="utf-8" ?>
2. 执行ant脚本
先将ant安装目录下面的bin目录加入系统环境变量
ant
执行当前目录下的build.xml中的默认target
ant -buildfile test.xml
执行test.xml中的默认target
ant -buildfile test.xml dist
执行test.xml中名为dist的target
在执行ant命令时可以增加 verbose参数,显示详细的信息
ant -verbose
或简写为
ant -v
3. warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
javac命令中没有明确指定includeantruntime的值
ANT官方文档对该属性的说明:
Whether to include the Ant run-time libraries in the classpath; defaults to yes
, unless build.sysclasspath
is set. It is usually best to set this to false so the script's behavior is not sensitive to the environment in which it is run.
示例如下:
<javac srcdir="src" destdir="classes" includeAntRuntime="false" />