<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>TaskDef Task</title>
</head>

<body>

<h2><a name="taskdef">Taskdef</a></h2>
<h3>Description</h3>
<p>Adds a task definition to the current project, such that this new task can be
used in the current project. Two attributes are needed, the name that identifies
this task uniquely, and the full name of the class (including the packages) that
implements this task.</p>
<p>You can also define a group of tasks at once using the file or
resource attributes.  These attributes point to files in the format of
Java property files.  Each line defines a single task in the
format:</p>
<pre>
taskname=fully.qualified.java.classname
</pre>
<p>Taskdef should be used to add your own tasks to the system. See also &quot;<a
href="../develop.html#writingowntask">Writing your own task</a>&quot;.</p>
<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
  <tr>
    <td valign="top"><b>Attribute</b></td>
    <td valign="top"><b>Description</b></td>
    <td align="center" valign="top"><b>Required</b></td>
  </tr>
  <tr>
    <td valign="top">name</td>
    <td valign="top">the name of the task</td>
    <td valign="top" align="center">Yes, unless file or resource have
    been specified.</td>
  </tr>
  <tr>
    <td valign="top">classname</td>
    <td valign="top">the full class name implementing the task</td>
    <td valign="top" align="center">Yes, unless file or resource have
    been specified.</td>
  </tr>
  <tr>
    <td valign="top">file</td>
    <td valign="top">Name of the property file to load
     taskname/classname pairs from.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">resource</td>
    <td valign="top">Name of the property resource to load
     taskname/classname pairs from.</td>
    <td valign="top" align="center">No</td>
  </tr>
  <tr>
    <td valign="top">classpath</td> <td valign="top">the classpath to
    use when looking up <code>classname</code> or
    <code>resource</code>.</td>
    <td align="center" valign="top">No</td>
  </tr>
  <tr>
    <td valign="top">classpathref</td>
    <td valign="top">Reference to a classpath to
    use when looking up <code>classname</code> or
    <code>resource</code>.</td>
    <td align="center" valign="top">No</td>
  </tr>
  <tr>
    <td valign="top">loaderRef</td> <td valign="top">the name of the loader that is
    used to load the class, constructed from the specified classpath. Use this to
    allow multiple tasks/types to be loaded with the same loader, so they can call
    each other. ( introduced in ant1.5 )</td>
    <td align="center" valign="top">No</td>
  </tr>
</table>
<h3>Parameters specified as nested elements</h3>
<h4>classpath</h4>
<p><code>Taskdef</code>'s <i>classpath</i> attribute is a <a
href="../using.html#path">PATH like structure</a> and can also be set via a nested
<i>classpath</i> element.</p>
<h3>Examples</h3>
<pre>  &lt;taskdef name=&quot;myjavadoc&quot; classname=&quot;com.mydomain.JavadocTask&quot;/&gt;</pre>
<p>makes a task called <code>myjavadoc</code> available to Ant. The class <code>com.mydomain.JavadocTask</code>
implements the task.</p>
<hr>
<p align="center">Copyright &copy; 2000-2002 Apache Software Foundation. All rights
Reserved.</p>

</body>
</html>