Sets a property if a certain condition holds true—this is a generalization of Available and Uptodate.
If the condition holds true, the property value is set to true
by default; otherwise, the
property is not set. You can set the value to something other than the default by specifying
the value attribute.
Conditions are specified as nested elements, you must specify exactly one condition.
Attribute | Description | Required |
---|---|---|
property | The name of the property to set. | Yes |
value | The value to set the property to. | No; defaults to true |
else | The value to set the property to if the condition evaluates to false. Since Apache Ant 1.6.3 |
No; by default the property will remain unset |
All conditions to test are specified as nested elements, for a complete list see here.
Set the property javamail.complete
if both the JavaBeans Activation Framework and
JavaMail are available in the classpath.
<condition property="javamail.complete"> <and> <available classname="javax.activation.DataHandler"/> <available classname="javax.mail.Transport"/> </and> </condition>
Set the property isMacOsButNotMacOsX
if the current operating system is MacOS, but
not MacOS X/macOS—which Ant considers to be in the Unix family as well.
<condition property="isMacOsButNotMacOsX"> <and> <os family="mac"/> <not> <os family="unix"/> </not> </and> </condition>
Set the property isSunOSonSparc
if the current operating system is SunOS and if it
is running on a SPARC architecture.
<condition property="isSunOSonSparc"> <os name="SunOS" arch="sparc"/> </condition>