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.

antlib.html 4.1 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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="antlib">AntLib</a></h2>
  8. <h3>Description</h3>
  9. <p>Defines and loads any tasks and datatypes contained in an ANT library.</p>
  10. <p>It also allows the aliasing of the names being defined in order to avoid
  11. collisions and provides means to override definitions with the ones defined
  12. in the library.</p>
  13. Ant libraries can be loaded in the current classloader, which is more efficient,
  14. but requires the tasks to be in the path already (such as in the ant lib
  15. directory) - set <tt>useCurrentClassloader</tt> to true to enable this.
  16. It is also possible to add more libraries to the path, such as any
  17. libraries the task is dependent on.
  18. <h3>Parameters</h3>
  19. <table border="1" cellpadding="2" cellspacing="0">
  20. <tr>
  21. <td valign="top"><b>Attribute</b></td>
  22. <td valign="top"><b>Description</b></td>
  23. <td align="center" valign="top"><b>Required</b></td>
  24. </tr>
  25. <tr>
  26. <td valign="top">file</td>
  27. <td valign="top">The jar-file of the library.</td>
  28. <td align="center" valign="middle" rowspan="2">at least one of the two</td>
  29. </tr>
  30. <tr>
  31. <td valign="top">library</td>
  32. <td valign="top">The name of a library relative to ${ant.home}/lib.</td>
  33. </tr>
  34. <tr>
  35. <td valign="top">override</td>
  36. <td valign="top">Replace any existing definition with the same name. (&quot;true&quot;/&quot;false&quot;). When &quot;false&quot; already defined tasks
  37. and datatytes take precedence over those in the library.
  38. Default is &quot;false&quot; when omitted.</td>
  39. <td align="center" valign="top">No</td>
  40. </tr>
  41. <tr>
  42. <td valign="top">useCurrentClassloader</td>
  43. <td valign="top">Set to &quot;true&quot; to avoid using a separate
  44. ClassLoader for the tasks in the library. Using this option requires
  45. that the library jar is already accessible by the ClassLoader of
  46. the project. Default is &quot;false&quot;.
  47. </td>
  48. <td align="center" valign="top">No</td>
  49. </tr>
  50. <tr>
  51. <td valign="top">classpath</td>
  52. <td valign="top">A
  53. <a href="../using.html#path">classpath</a>
  54. for extra libraries to pull in.
  55. </td>
  56. <td valign="top" align="center">No</td>
  57. </tr>
  58. </table>
  59. <h3><a name="nested">Parameters specified as nested elements</a></h3>
  60. <h4>alias</h4>
  61. <p>Specifies the usage of a different name from that defined in the library
  62. descriptor.</p>
  63. <table border="1" cellpadding="2" cellspacing="0">
  64. <tr>
  65. <td valign="top"><b>Attribute</b></td>
  66. <td valign="top"><b>Description</b></td>
  67. <td align="center" valign="top"><b>Required</b></td>
  68. </tr>
  69. <tr>
  70. <td valign="top">name</td>
  71. <td valign="top">The name used in the library descriptor.</td>
  72. <td valign="top" align="center">Yes</td>
  73. </tr>
  74. <tr>
  75. <td valign="top">as</td>
  76. <td valign="top">The alias to use in the project.</td>
  77. <td valign="top" align="center">Yes</td>
  78. </tr>
  79. </table>
  80. <p>Specifies the usage of a different name from that defined in the library
  81. descriptor. This is used to deal with name clashes </p>
  82. <h4>classpath</h4>
  83. <h4>classpath</h4>
  84. A classpath of extra libraries to import to support this task.
  85. <h4>classpathref</h4>
  86. A reference to an existing classpath.
  87. <h3>Examples</h3>
  88. <pre> &lt;antlib file=&quot;${build}/lib/mylib.jar&quot;/&gt;</pre>
  89. <p>loads the definitions from the library located at
  90. <code>${build}/lib/ant.jar</code>.</p>
  91. <pre> &lt;antlib library=&quot;optional.jar&quot;/&gt;</pre>
  92. <p>loads the definitions from the library <code>optional.jar</code>
  93. located at <code>${ant.home}/lib</code>.</p>
  94. <pre> &lt;antlib file=&quot;${build}/lib/mylib.jar&quot&gt;
  95. &lt;alias name=&quot;echo&quot; as=&quot;myecho&quot;/&gt;
  96. &lt;/antlib&gt;
  97. </pre>
  98. <p>loads the definitions from the library located at
  99. <code>${build}/lib/ant.jar</code> but uses the name
  100. &quot;<code>myecho</code>&quot; for the &quot;<code>echo</code>&quot; task
  101. declared in the library.</p>
  102. <hr><p align="center">Copyright &copy; 2000,2001 Apache Software Foundation. All rights
  103. Reserved.</p>
  104. </body>
  105. </html>