You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

available.html 3.5 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Ant User Manual</title>
  5. </head>
  6. <body>
  7. <h2><a name="available">Available</a></h2>
  8. <h3>Description</h3>
  9. <p>Sets a property if a resource is available at runtime. This resource can be a
  10. file resource, a class in classpath or a JVM system resource.</p>
  11. <p>If the resource is present, the property value is set to true by
  12. default, otherwise the property is not set. You can set the value to
  13. something specific by using the value attribute.</p>
  14. <p>Normally, this task is used to set properties that are useful to avoid target
  15. execution depending on system parameters.</p>
  16. <h3>Parameters</h3>
  17. <table border="1" cellpadding="2" cellspacing="0">
  18. <tr>
  19. <td valign="top"><b>Attribute</b></td>
  20. <td valign="top"><b>Description</b></td>
  21. <td align="center" valign="top"><b>Required</b></td>
  22. </tr>
  23. <tr>
  24. <td valign="top">property</td>
  25. <td valign="top">the name of the property to set.</td>
  26. <td valign="top" align="center">Yes</td>
  27. </tr>
  28. <tr>
  29. <td valign="top">value</td>
  30. <td valign="top">the value to set the property to. Defaults to &quot;true&quot;.</td>
  31. <td valign="top" align="center">No</td>
  32. </tr>
  33. <tr>
  34. <td valign="top">classname</td>
  35. <td valign="top">the class to look for in classpath.</td>
  36. <td valign="middle" align="center" rowspan="3">Yes</td>
  37. </tr>
  38. <tr>
  39. <td valign="top">resource</td>
  40. <td valign="top">the resource to look for in the JVM</td>
  41. </tr>
  42. <tr>
  43. <td valign="top">file</td>
  44. <td valign="top">the file to look for.</td>
  45. </tr>
  46. <tr>
  47. <td valign="top">classpath</td> <td valign="top">the classpath to
  48. use when looking up <code>classname</code>.</td> <td
  49. align="center" valign="top">No</td>
  50. </tr>
  51. <tr>
  52. <td valign="top">classpathref</td>
  53. <td valign="top">the classpath to use, given as <a href="../using.html#references">reference</a> to a path defined elsewhere.</td>
  54. <td align="center" valign="top">No</td>
  55. </tr>
  56. </table>
  57. <h3>Parameters specified as nested elements</h3>
  58. <h4>classpath</h4>
  59. <p><code>Available</code>'s <i>classpath</i> attribute is a <a
  60. href="../using.html#path">path-like structure</a> and can also be set via a nested
  61. <i>classpath</i> element.</p>
  62. <h3>Examples</h3>
  63. <pre> &lt;available classname=&quot;org.whatever.Myclass&quot; property=&quot;Myclass.present&quot;/&gt;</pre>
  64. <p>sets the property <code><i>Myclass.present</i></code> to the value &quot;true&quot;
  65. if the class <i>org.whatever.Myclass</i> is found in Ant's classpath.</p>
  66. <pre>
  67. &lt;property name=&quot;jaxp.jar&quot; value=&quot;./lib/jaxp11/jaxp.jar&quot;/&gt;
  68. &lt;available file=&quot;${jaxp.jar}&quot; property=&quot;jaxp.jar.present&quot;/&gt;
  69. </pre>
  70. <p>sets the property <code><i>jaxp.jar.present</i></code> to the value &quot;true&quot;
  71. if the file <i>./lib/jaxp11/jaxp.jar</i> is found.</p>
  72. <pre>
  73. ...in project ...
  74. &lt;property name=&quot;jaxp.jar&quot; value=&quot;./lib/jaxp11/jaxp.jar&quot;/&gt;
  75. &lt;path id=&quot;jaxp&quot; location=&quot;${jaxp.jar}&quot;/&gt;
  76. ...in target ...
  77. &lt;available classname=&quot;javax.xml.transform.Transformer&quot; classpathref=&quot;jaxp&quot; property=&quot;jaxp11.present&quot;/&gt;
  78. </pre>
  79. <p>sets the property <code><i>jaxp11.present</i></code> to the value &quot;true&quot;
  80. if the class <i>javax.xml.transform.Transformer</i> is found in the classpath referenced by <code>jaxp</code> (in this case, it is <code>./lib/jaxp11/jaxp.jar</code>).
  81. </p>
  82. <hr><p align="center">Copyright &copy; 2000,2001 Apache Software Foundation. All rights
  83. Reserved.</p>
  84. </body>
  85. </html>