Cari di Apache Ant 
    Apache Ant Tutorial
Daftar Isi
(Sebelumnya) ConcatSupported conditions (Berikutnya)
Apache Ant Tasks

Condition

Condition

Description

Sets a property if a certain condition holds true - this is ageneralization of Available and Uptodate.

If the condition holds true, the property value is set to true bydefault; otherwise, the property is not set. You can set the value tosomething other than the default by specifying the valueattribute.

Conditions are specified as nested elements,you must specify exactly one condition.

Parameters

Attribute Description Required
property The name of the property to set. Yes
value The value to set the property to. Defaults to "true". No
else The value to set the property to if the condition evaluates to false. By default the property will remain unset. Since Apache Ant 1.6.3 No

Parameters specified as nested elements

All conditions to test are specified as nested elements, for acomplete list see here.

Examples

  <condition property="javamail.complete"> <and>  <available classname="javax.activation.DataHandler"/>  <available classname="javax.mail.Transport"/> </and>  </condition>

sets the property javamail.complete if both theJavaBeans Activation Framework and JavaMail are available in theclasspath.

  <condition property="isMacOsButNotMacOsX"> <and>  <os family="mac"/>  <not> <os family="unix"/>  </not> </and>  </condition>

sets the property isMacOsButNotMacOsX if the currentoperating system is MacOS, but not MacOS X - which Ant considers to bein the Unix family as well.

  <condition property="isSunOSonSparc"> <os name="SunOS" arch="sparc"/>  </condition>

sets the property isSunOSonSparc if the currentoperating system is SunOS and if it is running on a sparc architecture.

(Sebelumnya) ConcatSupported conditions (Berikutnya)