## AntLib

### Description

Defines and loads any tasks and datatypes contained in an ANT library.

It also allows the aliasing of the names being defined in order to avoid collisions and provides means to override definitions with the ones defined in the library.

Ant libraries can be loaded in the current classloader, which is more efficient, but requires the tasks to be in the path already (such as in the ant lib directory) - set `useCurrentClassloader` to true to enable this. It is also possible to add more libraries to the path, such as any libraries the task is dependent on.

### Parameters

Attribute | Description | Required
file | The jar-file of the library. | at least one of the two
library | The name of a library relative to ${ant.home}/lib.
override | Replace any existing definition with the same name. ("true"/"false"). When "false" already defined tasks and datatytes take precedence over those in the library. Default is "false" when omitted. | No
useCurrentClassloader | Set to "true" to avoid using a separate ClassLoader for the tasks in the library. Using this option requires that the library jar is already accessible by the ClassLoader of the project. Default is "false". | No
classpath | A classpath for extra libraries to pull in. | No

### Parameters specified as nested elements

#### alias

Specifies the usage of a different name from that defined in the library descriptor.

Attribute | Description | Required
name | The name used in the library descriptor. | Yes
as | The alias to use in the project. | Yes

Specifies the usage of a different name from that defined in the library descriptor. This is used to deal with name clashes

#### classpath

A classpath of extra libraries to import to support this task.

#### classpathref

A reference to an existing classpath.

### Examples

      <antlib file="${build}/lib/mylib.jar"/>

loads the definitions from the library located at `${build}/lib/ant.jar`.

      <antlib library="optional.jar"/>

loads the definitions from the library `optional.jar` located at `${ant.home}/lib`.

      <antlib file="${build}/lib/mylib.jar">
        <alias name="echo" as="myecho"/>
      </antlib>

loads the definitions from the library located at `${build}/lib/ant.jar` but uses the name "`myecho`" for the "`echo`" task declared in the library.

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