Apache Ant Tasks 简明教程
Apache Ant Tasks - Condition
Description
条件任务在条件为 true 时默认将属性值设置为 true;否则,属性未设置。可以通过指定 value 属性将值设置为非默认值。
Condition task sets the property value to true by default if condition is true; otherwise, the property is not set. You can set the value to something other than the default by specifying the value attribute.
Properties
Sr.No |
Attributes & Description |
1 |
Property The name of the property to set. (Mandatory) |
2 |
Value The value to set the property to. |
3 |
Else The value to set the property to if the condition evaluates to false. |
Example
Usage
使用以下内容创建 build.xml −
Create build.xml with the following content −
<?xml version="1.0"?>
<project name="TutorialPoint" default="info">
<condition property="isWindows">
<os family="windows"/>
</condition>
<target name="info">
<echo message="${isWindows}"></echo>
</target>
</project>
上面的脚本将基于底层操作系统是否为 Windows,设置一个变量 is Windows。
Above script will set a variable is Windows based on the underlying operation system is windows or not.