jump to navigation

Building with Ant and Ivy March 31, 2008

Posted by Phill in General J2EE.
Tags: , , ,

At one of my previous workplaces we used to use Maven for our build system, along with Cruise Control.  It was a pretty good system – Maven worked quite well and did all of our dependency management without any problems.

In case you haven’t heard about Maven before, let me quickly explain one of the key benefits of it: you define all the dependencies of a project in an XML file (pom.xml), and during the build process Maven will go and download all the required .jar files for you to use in the build. (Obviously, it caches them so it only downloads the ones you don’t already have!). This is a simplification (Maven can do more), but you get the gist.

If I was starting a “green fields” project, Maven would be a good choice.

Having said that, if you’re already using a project and want the benefits of dependency resolution, or you’re starting a new project and want dependency resolution along with the flexibility of Ant, let me introduce you to an Ant sub-project: Ivy. It’s also a dependency resolution framework, except that it runs from within the Ant build process.  From my experimentations with it, it seems to run out-of-the-box with the Maven repository, and the dependency configuration is very similar.

But there are some very useful things Ivy has which Maven doesn’t, for example you can define a configuration for Oracle and a configuration for SQL Server, and the various .jar files will be included / excluded accordingly.

The Ivy project have a helpful comparison page listing some of the differences between Ivy and Maven 2.

There are a few downsides to dependency resolution, but I will hopefully cover those in a future article!



1. Allan - July 3, 2008

Now, we have a choice between Maven and Ivy. Here’s a sample setup we’ve tried on Ivy – http://www.ideyatech.com/2008/06/ apache-ivy-an-agile-dependency-manager/

2. Ant, dependencies, and slow servers « Phill’s J2EE Blog - January 26, 2009

[…] which uses an Apache Ant script to build it. Unfortunately we haven’t yet got around to using Apache Ivy, however all dependencies are stored in a text file and then downloaded from a central server in […]

Sorry comments are closed for this entry

%d bloggers like this: