Installing Maven Ant Tasks

For convenience, Maven Ant Tasks and all its dependencies are packaged together as a single JAR file.

There are two ways to use the tasks from your scripts.

Installing in Ant's lib directory

This is the simplest installation method but requires changes on every machine using the build file. You can place the JAR in your Ant lib directory, include it in the CLASSPATH environment variable, or pass it in to Ant using the -lib command line parameter.

Using this method, to make the tasks available in your build file, add the following namespace to the start of the file:

<project ... xmlns:artifact="antlib:org.apache.maven.artifact.ant">
  ...
</project>

Declaring a typedef

Using a typedef declaration allows you to store the Ant Tasks' library anywhere you like (such as source control) and put it's location in the build file. This can be used to bootstrap the tasks by using get to obtain the library, and then reference it from the build script.

The following example shows how to set it up, assuming the library is in the lib subdirectory of your current project.

<project ... xmlns:artifact="antlib:org.apache.maven.artifact.ant">
  ...
  <path id="maven-ant-tasks.classpath" path="lib/maven-ant-tasks-2.0.10.jar" />
  <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
           uri="antlib:org.apache.maven.artifact.ant"
           classpathref="maven-ant-tasks.classpath" />
  ...
</project>