Thursday, February 4, 2010

Section 1.3. Getting the Maven Tasks for Ant








1.3. Getting the Maven Tasks for Ant


Wait—didn't I just finish telling you that we're using Ant for the example
projects in this book? I did. But that wasn't the whole story. Although
Ant remains the foundation for the examples in this book, we've decided in
this second version also to leverage Maven's excellent dependency
management features via the Maven Tasks for Ant. The initial version of
this book spent precious pages providing instructions for downloading and
arranging a whole host of third-party libraries: everything from Jakarta
Commons Lang to CGLIB. (And from your perspective, it
meant you had to spend many precious minutes carefully and tediously
following those instructions.) In this version, we're declaring our
project's dependencies in our build.xml file and letting Maven take care of
downloading and managing our dependencies. This saves a ton of steps and
time. Now it's time to install the Maven Tasks for Ant.



1.3.1. How do I do that?


There are two ways to integrate the Maven Tasks for Ant: the first
is to drop the required JAR in Ant's lib directory, and the second is to include
the antlib via a <typedef> declaration
in an Ant build file. We're going to use the former method, and drop the
maven-ant-tasks-2.0.8.jar into
Ant's lib
directory because it requires the least amount of work in our example's
build.xml file, and makes it easier
to share between multiple projects. We'll get to creating build.xml later. First, let's download the necessary JAR file from the
Maven web site. On the
front page you should see a link to download Maven Tasks for Ant (see Figure 1-1).



Figure 1-1. Download link for Maven Tasks for Ant on Maven site








At the time of this writing, the Maven Tasks for Ant are at
version 2.0.8. Clicking on the Maven Tasks for
Ant 2.0.8
link and choosing a mirror will download a
JAR file named maven-ant-tasks-2.0.8.jar. Save this file to
a local directory.










No comments: