## AntJar

### Description

An extension of the Jar task with special treatment for the library descriptor file that should end up in the `META-INF` directory of the Ant Archive.

This task validates the provided library descriptor making certain it specifies the following SYSTEM ID: "http://jakarta.apache.org/ant/AntlibV1_0.dtd". This DTD is defined as follows:

    <?xml version='1.0' encoding="UTF8" ?>

    <!--
    This file defines the XML format for ANT library descriptors.
    Descriptors must especify a DOCTYPE of
    "http://jakarta.apache.org/ant/Antlib-V1_0.dtd"
    as the SystemId for the document.
    -->

    <!-- Root element for the Antlib descriptor.                 -->
    <!ELEMENT antlib (task | type)* >
    <!ATTLIST antlib
              version  CDATA #IMPLIED
    >

    <!-- Declaration of tasks contained in the library.          -->
    <!ELEMENT task EMPTY>
    <!ATTLIST task
              name     CDATA #REQUIRED
              class    CDATA #REQUIRED
    >

    <!-- Declaration of datatypes contained in the library       -->
    <!ELEMENT type EMPTY>
    <!ATTLIST type
              name     CDATA #REQUIRED
              class    CDATA #REQUIRED
    >

### Parameters

Attribute | Description | Required
antxml | The library descriptor to use (META-INF/antlib.xml). | Yes
Others... | All attributes inherited form the Jar task. |

### Nested elements

See the nested elements of the Jar task.

### Examples

      <antjar file="${dist}/lib/app.jar"
           antxml="${src}/applib.xml" basedir="${build}/classes"/>

jars all files in the `${build}/classes` directory into a file called `app.jar` in the `${dist}/lib` directory and sets the content of `${src}/applib.xml` as the library descriptor in `META-INF/antlib.xml`.

Here is a sample `META-INF/antlib.xml`:

    <?xml version="1.0" encoding="UTF8" ?>
    <!DOCTYPE antlib  SYSTEM "http://jakarta.apache.org/ant/Antlib-V1_0.dtd" >

    <antlib version="1.0" >
      <task name="case" class="org.apache.ant.contrib.Case" />
    </antlib>

Copyright © 2000,2001 Apache Software Foundation. All rights Reserved.