source: release-kits/lirk3/bin/ant-installer/web/manual1.6.2/manual/CoreTasks/available.html@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 5.4 KB
Line 
1<html>
2
3<head>
4<meta http-equiv="Content-Language" content="en-us">
5<title>Available Task</title>
6<link rel="stylesheet" type="text/css" href="../stylesheets/antmanual.css">
7</head>
8
9<body>
10
11<h2><a name="available">Available</a></h2>
12<h3>Description</h3>
13<p>Sets a property if a resource is available at runtime. This resource can be a
14file, a directory, a class in the classpath, or a JVM system resource.</p>
15<p>If the resource is present, the property value is set to true by
16default; otherwise, the property is not set. You can set the value to
17something other than the default by specifying the <code>value</code> attribute.</p>
18<p>Normally, this task is used to set properties that are useful to avoid target
19execution depending on system parameters.</p>
20<h3>Parameters</h3>
21<table border="1" cellpadding="2" cellspacing="0">
22 <tr>
23 <td valign="top"><b>Attribute</b></td>
24 <td valign="top"><b>Description</b></td>
25 <td align="center" valign="top"><b>Required</b></td>
26 </tr>
27 <tr>
28 <td valign="top">property</td>
29 <td valign="top">The name of the property to set.</td>
30 <td valign="top" align="center">Yes</td>
31 </tr>
32 <tr>
33 <td valign="top">value</td>
34 <td valign="top">The value to set the property to. Defaults to &quot;true&quot;.</td>
35 <td valign="top" align="center">No</td>
36 </tr>
37 <tr>
38 <td valign="top">classname</td>
39 <td valign="top">The class to look for in the classpath.</td>
40 <td valign="middle" align="center" rowspan="3">Yes</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">resource</td>
48 <td valign="top">The resource to look for in the JVM.</td>
49 </tr>
50 <tr>
51 <td valign="top">classpath</td>
52 <td valign="top">The classpath to use when looking up <code>classname</code> or <code>resource</code>.</td>
53 <td align="center" valign="top">No</td>
54 </tr>
55 <tr>
56 <td valign="top">filepath</td>
57 <td valign="top">The path to use when looking up <code>file</code>.</td>
58 <td align="center" valign="top">No</td>
59 </tr>
60 <tr>
61 <td valign="top">classpathref</td>
62 <td valign="top">The classpath to use, given as a <a href="../using.html#references">reference</a> to a path defined elsewhere.</td>
63 <td align="center" valign="top">No</td>
64 </tr>
65 <tr>
66 <td valign="top">type</td>
67 <td valign="top">The type of <code>file</code> to look for, either a directory (<code>type=&quot;dir&quot;</code>) or a file
68 (<code>type=&quot;file&quot;</code>). If not set, the property will be set if the name specified in the <code>file</code>
69 attribute exists as either a file or a directory.</td>
70 <td align="center" valign="top">No</td>
71 </tr>
72 <tr>
73 <td valign="top">ignoresystemclasses</td>
74 <td valign="top">Ignore Ant's runtime classes, using only the specified
75 classpath. Only affects the "classname" attribute. Defaults to &quot;false&quot;</td>
76 <td align="center" valign="top">No</td>
77 </tr>
78
79</table>
80<h3>Parameters specified as nested elements</h3>
81<h4>classpath</h4>
82<p><code>Available</code>'s <code>classpath</code> attribute is a <a
83href="../using.html#path">path-like structure</a> and can also be set via a nested
84<code>&lt;classpath&gt;</code> element.</p>
85<h4>filepath</h4>
86<p><code>Available</code>'s <code>filepath</code> attribute is a <a
87href="../using.html#path">path-like structure</a> and can also be set via a nested
88<code>&lt;filepath&gt;</code> element.</p>
89<h3>Examples</h3>
90<pre> &lt;available classname=&quot;org.whatever.Myclass&quot; property=&quot;Myclass.present&quot;/&gt;</pre>
91<p>sets the <code>Myclass.present</code> property to the value &quot;true&quot;
92if the class <code>org.whatever.Myclass</code> is found in Ant's classpath.</p>
93<pre>
94&lt;property name=&quot;jaxp.jar&quot; value=&quot;./lib/jaxp11/jaxp.jar&quot;/&gt;
95&lt;available file=&quot;${jaxp.jar}&quot; property=&quot;jaxp.jar.present&quot;/&gt;
96</pre>
97<p>sets the <code>jaxp.jar.present</code> property to the value &quot;true&quot;
98if the file <code>./lib/jaxp11/jaxp.jar</code> is found.</p>
99<pre>
100&lt;available file=&quot;/usr/local/lib&quot; type=&quot;dir&quot; property=&quot;local.lib.present&quot;/&gt;
101</pre>
102<p>sets the <code>local.lib.present</code> property to the value &quot;true&quot;
103if the directory <code>/usr/local/lib</code> is found.</p>
104<pre>
105...in project ...
106&lt;property name=&quot;jaxp.jar&quot; value=&quot;./lib/jaxp11/jaxp.jar&quot;/&gt;
107&lt;path id=&quot;jaxp&quot; location=&quot;${jaxp.jar}&quot;/&gt;
108...in target ...
109&lt;available classname=&quot;javax.xml.transform.Transformer&quot; classpathref=&quot;jaxp&quot; property=&quot;jaxp11.present&quot;/&gt;
110</pre>
111<p>sets the <code>jaxp11.present</code> property to the value &quot;true&quot;
112if the class <code>javax.xml.transform.Transformer</code> is found in the classpath referenced by <code>jaxp</code> (in this case, <code>./lib/jaxp11/jaxp.jar</code>).
113</p>
114<pre>
115&lt;available property=&quot;have.extras&quot; resource=&quot;extratasks.properties&quot;&gt;
116 &lt;classpath&gt;
117 &lt;pathelement location=&quot;/usr/local/ant/extra.jar/&gt;
118&nbsp;&nbsp;&lt;/classpath&gt;
119&lt;/available&gt;
120</pre>
121<p>sets the <code>have.extras</code> property to the value &quot;true&quot;
122if the resource-file <code>extratasks.properties</code> is found.
123</p>
124<hr><p align="center">Copyright &copy; 2000-2002,2004 The Apache Software Foundation. All rights
125Reserved.</p>
126
127</body>
128</html>
129
Note: See TracBrowser for help on using the repository browser.