2018-12-21 11:20:43 +01:00
|
|
|
<!DOCTYPE html>
|
2006-09-11 04:19:00 +00:00
|
|
|
<!--
|
|
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
|
|
this work for additional information regarding copyright ownership.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
(the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
2019-05-25 13:41:47 +02:00
|
|
|
https://www.apache.org/licenses/LICENSE-2.0
|
2006-09-11 04:19:00 +00:00
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
2018-12-21 11:20:43 +01:00
|
|
|
<html lang="en">
|
2001-02-13 12:32:01 +00:00
|
|
|
|
|
|
|
<head>
|
2005-04-29 18:58:16 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
2002-02-03 22:00:42 +00:00
|
|
|
<title>Available Task</title>
|
2001-02-13 12:32:01 +00:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
<h2 id="available">Available</h2>
|
2001-02-13 12:32:01 +00:00
|
|
|
<h3>Description</h3>
|
2018-03-18 07:55:29 +01:00
|
|
|
<p>Sets a property if a resource is available at run time. This resource can be a file, a directory,
|
2018-02-28 07:58:59 +01:00
|
|
|
a class in the classpath, or a JVM system resource.</p>
|
2018-08-13 20:27:54 +02:00
|
|
|
<p><strong>Note</strong>: a class is available in the classpath when it can be loaded; i.e., all
|
|
|
|
classes it depends on must be in the classpath, too.</p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>If the resource is present, the property value is set to <q>true</q> by default; otherwise, the
|
|
|
|
property is not set. You can set the value to something other than the default by specifying
|
|
|
|
the <var>value</var> attribute.</p>
|
|
|
|
<p>Normally, this task is used to set properties that are useful to avoid target execution depending
|
|
|
|
on system parameters.</p>
|
2001-02-13 12:32:01 +00:00
|
|
|
<h3>Parameters</h3>
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2001-02-13 12:32:01 +00:00
|
|
|
<tr>
|
2018-05-15 10:29:27 +02:00
|
|
|
<th scope="col">Attribute</th>
|
|
|
|
<th scope="col">Description</th>
|
|
|
|
<th scope="col">Required</th>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>property</td>
|
|
|
|
<td>The name of the property to set.</td>
|
|
|
|
<td>Yes</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>value</td>
|
|
|
|
<td>The value to set the property to.</td>
|
|
|
|
<td>No; defaults to <q>true</q></td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>classname</td>
|
|
|
|
<td>The class to look for in the classpath.</td>
|
|
|
|
<td rowspan="3">Exactly one of the three</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>file</td>
|
|
|
|
<td class="left">The file to look for.</td>
|
2001-04-30 23:25:36 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>resource</td>
|
|
|
|
<td class="left">The resource to look for in the JVM.</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>classpath</td>
|
|
|
|
<td>The classpath to use when looking up <var>classname</var> or <var>resource</var>.</td>
|
|
|
|
<td>No</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
2001-08-30 13:23:14 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>filepath</td>
|
|
|
|
<td>The path to use when looking up <var>file</var>.</td>
|
|
|
|
<td>No</td>
|
2001-08-30 13:23:14 +00:00
|
|
|
</tr>
|
2001-02-13 12:32:01 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>classpathref</td>
|
|
|
|
<td>The classpath to use, given as a <a href="../using.html#references">reference</a> to a path
|
|
|
|
defined elsewhere.</td>
|
|
|
|
<td>No</td>
|
2001-05-03 07:41:11 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>type</td>
|
|
|
|
<td>The type of <var>file</var> to look for, either a directory (<var>type</var>=<q>dir</q>) or
|
|
|
|
a file (<var>type</var>=<q>file</q>). If not set, the property will be set if the name specified
|
|
|
|
in the <var>file</var> attribute exists as either a file or a directory.</td>
|
|
|
|
<td>No</td>
|
2001-02-13 12:32:01 +00:00
|
|
|
</tr>
|
2002-03-19 22:45:06 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>ignoresystemclasses</td>
|
|
|
|
<td>Ignore Ant's runtime classes, using only the specified classpath. Only affects
|
|
|
|
the <var>classname</var> attribute.</td>
|
|
|
|
<td>No; defaults to <q>false</q></td>
|
2002-03-19 22:45:06 +00:00
|
|
|
</tr>
|
2006-09-06 21:19:42 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>searchparents</td>
|
|
|
|
<td>This contains the behaviour of the <q>file</q> <var>type</var>. If <q>true</q>, the task
|
|
|
|
will, when searching for a file, search not only the directories specified but will also search
|
|
|
|
the parent directories of those specified. If <q>false</q>, only the directories specified will
|
|
|
|
be searched. <em>Since Ant 1.7</em></td>
|
|
|
|
<td>No; defaults to <q>false</q></td>
|
2006-09-06 21:19:42 +00:00
|
|
|
</tr>
|
2001-02-13 12:32:01 +00:00
|
|
|
</table>
|
|
|
|
<h3>Parameters specified as nested elements</h3>
|
|
|
|
<h4>classpath</h4>
|
2018-03-10 20:17:33 +01:00
|
|
|
<p><code>Available</code>'s <var>classpath</var> attribute is
|
2018-02-28 07:58:59 +01:00
|
|
|
a <a href="../using.html#path">path-like structure</a> and can also be set via a nested
|
2001-04-30 23:25:36 +00:00
|
|
|
<code><classpath></code> element.</p>
|
2001-08-30 13:23:14 +00:00
|
|
|
<h4>filepath</h4>
|
2018-03-10 20:17:33 +01:00
|
|
|
<p><code>Available</code>'s <var>filepath</var> attribute is
|
2018-02-28 07:58:59 +01:00
|
|
|
a <a href="../using.html#path">path-like structure</a> and can also be set via a
|
|
|
|
nested <code><filepath></code> element.</p>
|
2018-05-15 09:51:58 +02:00
|
|
|
|
2001-02-13 12:32:01 +00:00
|
|
|
<h3>Examples</h3>
|
2018-05-15 09:51:58 +02:00
|
|
|
<p>Set the <code>Myclass.present</code> property to the value <q>true</q> if the
|
2018-02-28 07:58:59 +01:00
|
|
|
class <code>org.whatever.Myclass</code> is found in Ant's classpath.</p>
|
2018-05-15 09:51:58 +02:00
|
|
|
<pre><available classname="org.whatever.Myclass" property="Myclass.present"/></pre>
|
|
|
|
|
|
|
|
<p>Set the <code>jaxp.jar.present</code> property to the value <q>true</q> if the
|
|
|
|
file <samp>./lib/jaxp11/jaxp.jar</samp> is found.</p>
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2001-02-13 12:32:01 +00:00
|
|
|
<property name="jaxp.jar" value="./lib/jaxp11/jaxp.jar"/>
|
2018-02-28 07:58:59 +01:00
|
|
|
<available file="${jaxp.jar}" property="jaxp.jar.present"/></pre>
|
2018-05-15 09:51:58 +02:00
|
|
|
|
|
|
|
<p>Set the <code>local.lib.present</code> property to the value <q>true</q> if the
|
|
|
|
directory <samp>/usr/local/lib</samp> is found.</p>
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2005-03-08 18:17:40 +00:00
|
|
|
<available file="/usr/local/lib" type="dir"
|
2018-02-28 07:58:59 +01:00
|
|
|
property="local.lib.present"/></pre>
|
2018-05-15 09:51:58 +02:00
|
|
|
|
|
|
|
<p>Set the <code>jaxp11.present</code> property to the value <q>true</q> if the
|
|
|
|
class <code>javax.xml.transform.Transformer</code> is found in the classpath referenced
|
|
|
|
by <samp>jaxp</samp> (in this case, <samp>./lib/jaxp11/jaxp.jar</samp>).</p>
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2001-02-13 12:32:01 +00:00
|
|
|
...in project ...
|
|
|
|
<property name="jaxp.jar" value="./lib/jaxp11/jaxp.jar"/>
|
|
|
|
<path id="jaxp" location="${jaxp.jar}"/>
|
|
|
|
...in target ...
|
2005-03-08 18:17:40 +00:00
|
|
|
<available classname="javax.xml.transform.Transformer"
|
2018-02-28 07:58:59 +01:00
|
|
|
classpathref="jaxp" property="jaxp11.present"/></pre>
|
2018-05-15 09:51:58 +02:00
|
|
|
|
|
|
|
<p>Set the <code>have.extras</code> property to the value <q>true</q> if the resource
|
|
|
|
file <samp>extratasks.properties</samp> is found.</p>
|
2018-02-09 06:54:03 +01:00
|
|
|
<pre>
|
2001-04-30 23:25:36 +00:00
|
|
|
<available property="have.extras" resource="extratasks.properties">
|
|
|
|
<classpath>
|
2018-02-28 07:58:59 +01:00
|
|
|
<pathelement location="/usr/local/ant/extra.jar"/>
|
2018-02-08 22:56:19 +01:00
|
|
|
</classpath>
|
2018-02-28 07:58:59 +01:00
|
|
|
</available></pre>
|
2006-09-11 20:22:51 +00:00
|
|
|
|
2001-02-13 12:32:01 +00:00
|
|
|
</body>
|
|
|
|
</html>
|