add ant task documentation

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@164555 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-04-25 10:32:56 +00:00
parent bfd3f284e2
commit 70af16d170
4 changed files with 139 additions and 0 deletions

View File

@ -38,6 +38,7 @@
with the largest Open Source projects for real-time availability of their latest releases</li>
<li>Extensible, with the ability to easily write plugins in Java or other scripting languages</li>
<li>Instant access to new features with little or no extra configuration</li>
<li><a href="ant-tasks.html">Ant tasks</a> for dependency management and deployment outside of Maven</li>
</ul>
<p>
The following features are available in Maven 1.0 and will be available and much improved in Maven 2.0 through

View File

@ -0,0 +1,124 @@
<document>
<properties>
<title>Ant Tasks for Maven 2.0</title>
<author email="brett@apache.org">Brett Porter</author>
</properties>
<body>
<section name="Ant Tasks for Maven 2.0">
<p>
Maven 2.0 now comes with a set of Ant tasks that can be used to utilise Maven's artifact handling features
from within Ant 1.6+ or Maven 1.0+. This includes:
</p>
<ul>
<li>
<i>Dependency management</i> - including transitive dependencies, scope recognition and SNAPSHOT handling
</li>
<li>
<i>Artifact deployment</i> - file and SSH based deployment to a Maven repository
</li>
<li>
<i>POM processing</i> - for reading a Maven 2.0
<code>pom.xml</code> file
</li>
</ul>
<p>
The Ant tasks can be downloaded from the
<a href="download.html#ant">Maven 2.0 download page</a>.
</p>
<subsection name="Installing the Ant Tasks">
<p>
For convenience, the Ant task and all its dependencies are packaged together as a single JAR file.
While you can declare this in a classpath to pass to your own
<code>typedef</code> element, this guide
assumes you have installed the JAR in the
<code>lib</code> directory of your Ant installation.
</p>
</subsection>
</section>
<section name="Using the Ant tasks">
<subsection name="Including the Artifact Namespace">
<p>
To use the artifact tasks, assuming that the library has been installed in your Ant <code>lib</code>
directory, add the following namespace to your <code>build.xml</code> file:
</p>
<source><![CDATA[<project ... xmlns:artifact="antlib:org.apache.maven.artifact.ant">]]></source>
</subsection>
<subsection name="Declaring Dependencies">
<p>
The main purpose of the Ant tasks is to allow you to specify dependencies inside your Ant script, for
example:
</p>
<source><![CDATA[<artifact:dependencies pathId="dependency.classpath">
<dependency groupId="org.apache.maven.wagon" artifactId="wagon-provider-test" version="1.0-alpha-2"/>
<dependency groupId="org.codehaus.modello" artifactId="modello-core" version="1.0-alpha-2-SNAPSHOT"/>
<localRepository location="${basedir}/target/local-repo" />
</artifact:dependencies>]]></source>
<p>
This will download the two dependencies given above, and additionally any dependencies they have (as long
as they have the appropriate scope). The JAR files of all of the dependencies will be added to the
Ant reference <code>dependency.classpath</code>, so that it can be used later, like so:
</p>
<source><![CDATA[<java ... classpathref="dependency.classpath" />]]></source>
<p>
You can also specify a <code>scope</code> parameter on each dependency. This changes the behaviour of
transitive dependencies and is useful for building different types of classpaths. To see how it affects
the behaviour of the dependencies, see the <a href="dependencies.html#Dependency_Scope">Dependency Mechanism</a>
documentation in the Maven 2.0 site.
</p>
<p>
The local repository given above is optional, and defaults to <code>${user.home}/.m2/repository</code>.
This is where the downloaded JAR files are stored and referenced from.
</p>
</subsection>
<subsection name="Declaring Repositories">
<p>
All of the tasks can optionally take one or more remote repositories to download from and upload to and a
local repository to store downloaded and installed archives to.
</p>
<p>
These can be specified inline, or if you choose to reuse them, they can be declared with an id/refid
combination.
</p>
<source><![CDATA[<artifact:remoteRepository id="remote.repository" url="http://repo1.maven.org/maven2" />]]></source>
<p>
If not remote repositories are specified, the default
<a href="http://repo1.maven.org/maven2">http://repo1.maven.org/maven2/</a>
is used. This is a complete copy of Ibiblio.
</p>
<p>
<b>Note: </b> to work with transitive dependencies, you <i>must</i> use a Maven 2.0 style repository, not a
Maven 1.0 style repository. Tools are available to convert a Maven 1.0 repository to Maven 2.0 - please
contact the mailing lists if you require this as it has not yet been formally released.
</p>
<p>
If your repository requires authentication, you can provide this as a nested element. It accepts the
attributes <code>username</code>, <code>password</code>, and for SSH based repositories <code>privateKey</code>
and <code>passphrase</code>. For example:
</p>
<source><![CDATA[<authentication username="brett" privateKey="${user.home}/.ssh/id_dsa" />]]></source>
</subsection>
<subsection name="Installing and Deploying Your Own Artifacts">
<p>
If you want to share your built artifacts between projects, you can use two other tasks: <code>install</code> for placing
them in your local repository for access as dependencies in other scripts, and <code>deploy</code> for deploying
them to an remote location you have set up to serve as a repository in your organisation.
</p>
<p>
Please refer to the sample script for usage.
</p>
</subsection>
<subsection name="Sample Ant Script">
<p>
The file <a href="http://svn.apache.org/repos/asf/maven/components/trunk/maven-artifact-ant/sample.build.xml">sample.build.xml</a>
is a sample Ant script showing some of the functionality in action.
</p>
</subsection>
<subsection name="Getting Help">
<p>
If you have any questions specific to the Ant tasks, please contact the <a href="mail-lists.html">Maven Users Mailing List</a>.
</p>
</subsection>
</section>
</body>
</document>

View File

@ -46,6 +46,19 @@
</span>
</li>
</ul>
<a name="ant"></a>
<p>
Also available is a distribution suitable for use with Ant and Maven 1.x to use Maven 2.0's dependency
management (including transitive dependencies), repository and artifact deployment support.
See <a href="ant-tasks.html">Ant Tasks</a> for more information and installation instructions.
</p>
<ul>
<li>
<a href="http://www.apache.org/dyn/closer.cgi/maven/binaries/maven-artifact-ant-2.0-alpha-1.jar">
<code>.jar</code> archive
</a>
</li>
</ul>
<p>
Maven 2.0 is distributed under the
<a href="http://maven.apache.org/license.html">Apache License, version 2.0</a>.

View File

@ -23,6 +23,7 @@
<item name="Project Descriptor" href="project-descriptor.html"/>
<item name="Settings Descriptor" href="settings-descriptor.html"/>
<item name="Available Plugins" href="plugin-list.html"/>
<item name="Ant Tasks" href="ant-tasks.html"/>
</menu>
<menu name="Developers">
<item name="Documentation Needed" href="docs-required.html"/>