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.

taskdef.html 2.7 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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="taskdef">Taskdef</a></h2>
  8. <h3>Description</h3>
  9. <p>Adds a task definition to the current project, such that this new task can be
  10. used in the current project. Two attributes are needed, the name that identifies
  11. this task uniquely, and the full name of the class (including the packages) that
  12. implements this task.</p>
  13. <p>You can also define a group of tasks at once using the file or
  14. resource attributes. These attributes point to files in the format of
  15. Java property files. Each line defines a single task in the
  16. format:</p>
  17. <pre>
  18. taskname=fully.qualified.java.classname
  19. </pre>
  20. <p>Taskdef should be used to add your own tasks to the system. See also &quot;<a
  21. href="../develop.html#writingowntask">Writing your own task</a>&quot;.</p>
  22. <h3>Parameters</h3>
  23. <table border="1" cellpadding="2" cellspacing="0">
  24. <tr>
  25. <td valign="top"><b>Attribute</b></td>
  26. <td valign="top"><b>Description</b></td>
  27. <td align="center" valign="top"><b>Required</b></td>
  28. </tr>
  29. <tr>
  30. <td valign="top">name</td>
  31. <td valign="top">the name of the task</td>
  32. <td valign="top" align="center">Yes, unless file or resource have
  33. been specified.</td>
  34. </tr>
  35. <tr>
  36. <td valign="top">classname</td>
  37. <td valign="top">the full class name implementing the task</td>
  38. <td valign="top" align="center">Yes, unless file or resource have
  39. been specified.</td>
  40. </tr>
  41. <tr>
  42. <td valign="top">file</td>
  43. <td valign="top">Name of the property file to load
  44. taskname/classname pairs from.</td>
  45. <td valign="top" align="center">No</td>
  46. </tr>
  47. <tr>
  48. <td valign="top">resource</td>
  49. <td valign="top">Name of the property resource to load
  50. taskname/classname pairs from.</td>
  51. <td valign="top" align="center">No</td>
  52. </tr>
  53. <tr>
  54. <td valign="top">classpath</td> <td valign="top">the classpath to
  55. use when looking up <code>classname</code> or
  56. <code>resource</code>.</td>
  57. <td align="center" valign="top">No</td>
  58. </tr>
  59. </table>
  60. <h3>Parameters specified as nested elements</h3>
  61. <h4>classpath</h4>
  62. <p><code>Taskdef</code>'s <i>classpath</i> attribute is a <a
  63. href="../using.html#path">PATH like structure</a> and can also be set via a nested
  64. <i>classpath</i> element.</p>
  65. <h3>Examples</h3>
  66. <pre> &lt;taskdef name=&quot;myjavadoc&quot; classname=&quot;com.mydomain.JavadocTask&quot;/&gt;</pre>
  67. <p>makes a task called <code>myjavadoc</code> available to Ant. The class <code>com.mydomain.JavadocTask</code>
  68. implements the task.</p>
  69. <hr>
  70. <p align="center">Copyright &copy; 2000,2001 Apache Software Foundation. All rights
  71. Reserved.</p>
  72. </body>
  73. </html>