next up previous contents index
Next: Basename Up: Available Previous: Parameters specified as nested   Contents   Index

Examples

  <available classname="org.whatever.Myclass" property="Myclass.present"/>
sets the Myclass.present property to the value "true" if the class org.whatever.Myclass is found in Ant's classpath.
<property name="jaxp.jar" value="./lib/jaxp11/jaxp.jar"/>
<available file="${jaxp.jar}" property="jaxp.jar.present"/>
sets the jaxp.jar.present property to the value "true" if the file ./lib/jaxp11/jaxp.jar is found.
<available file="/usr/local/lib" type="dir" property="local.lib.present"/>
sets the local.lib.present property to the value "true" if the directory /usr/local/lib is found.
...in project ...
<property name="jaxp.jar" value="./lib/jaxp11/jaxp.jar"/>
<path id="jaxp" location="${jaxp.jar}"/>
...in target ...
<available classname="javax.xml.transform.Transformer" 
  classpathref="jaxp" property="jaxp11.present"/>
sets the jaxp11.present property to the value "true" if the class javax.xml.transform.Transformer is found in the classpath referenced by jaxp (in this case, ./lib/jaxp11/jaxp.jar).
<available property="have.extras" resource="extratasks.properties">
  <classpath>
    <pathelement location="/usr/local/ant/extra.jar/>
  </classpath>
</available>
sets the have.extras property to the value "true" if the resource-file extratasks.properties is found.



Andrew Marlow 2003-07-08