| -------- |
| Installation |
| -------- |
| Brett Porter |
| Hervé Boutemy |
| -------- |
| 2008-07-17 |
| -------- |
| |
| ~~ Licensed to the Apache Software Foundation (ASF) under one |
| ~~ or more contributor license agreements. See the NOTICE file |
| ~~ distributed with this work for additional information |
| ~~ regarding copyright ownership. The ASF licenses this file |
| ~~ to you under the Apache License, Version 2.0 (the |
| ~~ "License"); you may not use this file except in compliance |
| ~~ with the License. You may obtain a copy of the License at |
| ~~ |
| ~~ http://www.apache.org/licenses/LICENSE-2.0 |
| ~~ |
| ~~ Unless required by applicable law or agreed to in writing, |
| ~~ software distributed under the License is distributed on an |
| ~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| ~~ KIND, either express or implied. See the License for the |
| ~~ specific language governing permissions and limitations |
| ~~ under the License. |
| |
| ~~ NOTE: For help with the syntax of this file, see: |
| ~~ http://maven.apache.org/doxia/references/apt-format.html |
| |
| Installing Maven Ant Tasks |
| |
| For convenience, Maven Ant Tasks and all its dependencies are packaged together as a single JAR file. |
| This can be downloaded from the {{{./download.html} download page}}. |
| |
| 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-${project.version}.jar" /> |
| <typedef resource="org/apache/maven/artifact/ant/antlib.xml" |
| uri="antlib:org.apache.maven.artifact.ant" |
| classpathref="maven-ant-tasks.classpath" /> |
| ... |
| </project> |
| ----- |
| |