<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 "<a href="../develop.html#writingowntask">Writing your own task</a>".</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> </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> <taskdef name="myjavadoc" classname="com.mydomain.JavadocTask"/></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 © 2001 Apache Software Foundation. All rights Reserved.</p> </body> </html>