📅  最后修改于: 2020-12-26 13:33:54             🧑  作者: Mango
属性是键值对,其中每个值都与一个键相关联。该属性用于设置可在构建文件中的任何位置访问的值。设置属性后,将无法更改它。
Apache Ant提供了
Apache Ant提供了各种内置属性,我们可以在buildfile中访问所有这些属性。下面提供了一些内置属性。
Property | Description |
---|---|
basedir | It is used for the absolute path of the project’s basedir. |
ant.file | It is used for the absolute path of the buildfile. |
ant. | versionIt is used for the version of Ant. |
ant.project.name | It holds name of the project that is currently executing. |
ant.project.default-target | It holds name of the currently executing project’s default target. |
ant.project.invoked-targets | A list of the targets when invoking the current project. |
ant.java.version | It holds the JVM version. |
ant.core.lib | the absolute path of the ant.jar file. |
ant.home | It contains home directory of Ant. |
ant.library.dir | It holds the directory that has been used to load Ant’s jars from. |
除了内置属性外,Apache Ant还提供了在buildfile中创建自定义属性的功能。
要创建属性,提供了
为了进一步理解,让我们看一个例子。
// build.xml
${student-name} is our student.
输出: