Ivy has lots of potential

April 9, 2007 – 21:14 | java

Having recently been severely frustrated by that other ambitious Apache project that aims at “making the build process easy”, and “providing guidelines for best practices development”, etc. - OK, who am I kidding? Yes, I’m referring to maven 2. :-) - I turned my eyes to Ivy, and, after a couple of week of using it, found myself comfortable enough to write this to recommend Ivy as an indispensable part in any serious Ant-based build tools arsenal.

What do I like about Ivy? Well, let me start with the fact that it doesn’t try to reinvent Ant, but rather serves as an extension to Ant (and can also run stand-alone outside any Ant context). It is essentially a dependency management engine - it focuses on being a good one at that, and once dependencies are resolved and retrieved, it stays out of the way for the rest of the build process.

Ivy offers a powerful expression language for specifying a variety of version patterns. There can be patterns like “1.4.+”, which can be satisfied by any version later than 1.4, “[1.4,)", which means any version of 1.4 or after, or "[1.4,1.9], which selects any version between 1.4 and 1.9, including both.

The concept of “configuration” in Ivy also comes in very handy when you need to categorize the dependencies, and influence how classpaths ought to be assembled according to the different contexts they’ll be used in - e.g., I was able to define configurations called “build”, “test”, “coverage” to deal with dependencies required at build-time, test-time, and test-with-emma-the-coverage-tool-time.

Another strong selling point of Ivy is that it has built-in support to leverage the existing ibiblio maven repositories. Ivy’s ibiblio resolver works with maven 1 repository by default, but can be set in “m2compatible” mode with one attribute flip. The more universal URL resolver in Ivy can work with pretty much any repository structure whose paths are defined in patterns. Although for most practical projects, the out-of-box ibiblio support, combined with the cache resolver that tries to resolve artifacts in the local cache first, would suffice very well.

The one caveat I found out, though, is that at the moment the ibilbio resolver doesn’t handle the directory listing of some existing maven repository proxy tools, such as maven-proxy and proximity. So the dynamic version resolving (such as range or wildcarded version numbers) feature, relying on the resolver parsing directory listing to discover available versions, won’t work when there is a ibiblio resolver points to a proxy server. According to the developers, this issue is definitely on the radar and hopefully will be addressed by the time the next major version (2.0) comes out. Possible workarounds I’m contemplating on include setting up a reverse proxy with an internal apache server, or adding an extra Ivy resolver pointing to the internal repository. I’ll try those and report back.

As Ivy has recently been taken under the Apache wings, and become an Apache Incubator project, I hold high hope on its codebase maturing rapidly and eventually graduates to be yet another great Apache tool. I believe as far as build management is concerned, Ivy offers a great opportunity to leverage and combine the two valuable assets the Java community has built over the years - the mature Ant toolset and the sophisticated ibiblio maven repositories. As Colin Sampaleanu pointed out, the decision to use Ivy is a no-brainer.

Trackback from your site, or follow the comments in RSS.
  1. One Response to “Ivy has lots of potential”

  2. Interestingly enough I left Ivy and fell in love with M2 almost a year ago. The thing that’s missing from Ant and Ivy is the “build system”. They are both excellent tools with which you can use to write a build system but who wants yet another project to maintain? Many developers don’t realize that a build system is a prject in and of itself, and a downright complicated one. It needs to be maintained just as much as the project it builds. I’ve been keeping my eye on GAnt (actually I’ve taken my eye off of it for about a month but I’m going to look again). The point is that I don’t want to write or maintain another build system again. That is where projects like Maven2, Equinox, Rails, Grails and Appfuse shine. They come with a build system included. What would be really nice would be an build system, based on Ant/Ivy with a friendlier extension mechanism and interface than Maven2. In other words, I’d like to be able to say, “create java-project” or “create web-project” and then say “install” or “deploy” without writing a single line of build logic. I’d then like to be able to do things like skip my unit tests on a particular iteration without having to refer to the docs. I’d then like to be able to tweak one of the build system plugins or create a plugin as easily as I can with tweak or create an Ant task. I’m asking for the best of both worlds. I want my cake and eat it too. (Why are you eating my cake? Can I get a fork?) Can somebody please make a build system for Java with Ant/Ivy that’s not hard-wired to a web framework?Ya’ feelin’ me?

    By Cliff on Apr 11, 2007

Post a Comment