| <html> |
| |
| <head> |
| <meta http-equiv="Content-Language" content="en-us"> |
| <title>Ant User Manual</title> |
| </head> |
| |
| <body> |
| |
| <h2><a name="antjar">AntJar</a></h2> |
| <h3>Description</h3> |
| <p>An extension of the <a href="jar.html">Jar</a> task with special |
| treatment for the library descriptor file that should end up in the |
| <code>META-INF</code> directory of the Ant Archive.</p> |
| <p> |
| Descriptors must follow the following rules, although there is no fix DTD |
| for them: |
| <pre> |
| |
| <!-- Root element for the Antlib descriptor. --> |
| <!ELEMENT antlib (role | <i>rolename</i>)* > |
| |
| <!-- Declaration of roles contained in the library. --> |
| <!ELEMENT role EMPTY> |
| <!ATTLIST role |
| name CDATA #REQUIRED |
| class CDATA #REQUIRED |
| proxy CDATA #IMPLIED |
| > |
| |
| <!-- Declaration of datatypes contained in the library --> |
| <!ELEMENT <i>rolename</i> EMPTY> |
| <!ATTLIST <i>rolename</i> |
| name CDATA #REQUIRED |
| class CDATA #REQUIRED |
| > |
| |
| </pre> |
| There are two predefined roles: <i><b>task</b></i> and <i><b>datatype</b></i>. |
| <p> |
| <h4>Role definition</h4> |
| The <b>name</b> of the role. This name is used when specifying |
| elements for this role. |
| <p> |
| The <b>class</b> defining a role must be an interface containing a |
| unique void method with only one argument whose type is the that of |
| elements declared on the role. |
| <p> |
| The <b>proxy</b> defined in a role specifies a class that can be used |
| to bridge between the type expected by the role and the type of |
| elements declared for that role. |
| <h4>Element definition</h4> |
| Any element whose name is that of a role declares an element for that role. |
| <p> |
| The <b>name</b> defined the name of the element to use in the buildfile |
| to specify the element being declared. |
| <p> |
| The <b>class</b> the class defining the element. |
| <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">antxml</td> |
| <td valign="top">The library descriptor to use (META-INF/antlib.xml).</td> |
| <td valign="top" align="center">Yes</td> |
| </tr> |
| <tr> |
| <td valign="top"><b>Others...</b></td> |
| <td valign="top">All attributes inherited form the |
| <a href="jar.html">Jar task</a>.</td> |
| <td valign="top" align="center"> </td> |
| </tr> |
| </table> |
| <h3>Nested elements</h3> |
| See the nested elements of the <a href="jar.html">Jar task</a>. |
| <h3>Examples</h3> |
| <pre> <antjar file="${dist}/lib/app.jar" |
| antxml="${src}/applib.xml" basedir="${build}/classes"/></pre> |
| <p>jars all files in the <code>${build}/classes</code> directory into a file |
| called <code>app.jar</code> in the <code>${dist}/lib</code> directory and |
| sets the content of <code>${src}/applib.xml</code> as the library descriptor |
| in <code>META-INF/antlib.xml</code>.</p> |
| <p>Here is a sample <code>META-INF/antlib.xml</code>:</p> |
| <pre> |
| <?xml version="1.0" encoding="UTF8" ?> |
| |
| <antlib version="1.0" > |
| <task name="case" class="org.apache.ant.contrib.Case" /> |
| </antlib> |
| |
| </pre> |
| <hr> |
| <p align="center">Copyright © 2000,2001 Apache Software Foundation. All rights |
| Reserved.</p> |
| |
| </body> |
| </html> |
| |