1. project元素
project 元素是 Ant 构件文件的根元素, Ant 构件文件至少应该包含一个 project 元素,否则会发生错误。在每个 project 元素下,可包含多个 target 元素。接下来向读者展示一下 project 元素的各属性。
1) name 属性
用于指定 project 元素的名称。
2) default 属性
用于指定 project 默认执行时所执行的 target 的名称。
3) basedir 属性
用于指定基路径的位置。该属性没有指定时,使用 Ant 的构件文件的附目录作为基准目录。
Example:<?xml version="1.0" ?>
<project name="AntTest" default="First target" basedir=".">
<target name="First target">
<echo message="The basedir is ${basedir}" />
</target>
</project>
Output:
Buildfile: D:\ljgworkspace\labEnvironment\build.xml
First target:
[echo] The basedir is D:\ljgworkspace\labEnvironment
BUILD SUCCESSFUL
Total time: 563 milliseconds
小结:
echo标签的作用是在console控制台输出信息,当发生build失败的时候能够提供一些有用的提示信息