It’s been quite interesting to play with Ant 1.6. I’ve trying to figure out the best way to share macrodef snippets between projects, and I think I found my preferred way for now. There are two ways I see for sharing Ant macros:

  1. Placing a common project in a well-known directory (typically up the directory hierarchy a bit), and then having all build files import that file
  2. Using the new antlib to define the macros, and then bringing those definitions into the current build file

I think that the metaphor I’ll use is that common build files are a part of a separate, deployable project. This approach should support:

To meet those needs, I’ll do the following:

One challenge is that always using ant -lib ... is bound to become tedious. Perhaps the local environment could be set to use this automatically, but that violates one of the goals. I’d prefer setting up the Ant libraries per-project rather than cluttering my local Ant installation, and hoping that everyone else has the needed libraries. This approach comes closest to doing that consistently than any other I’ve seen so far. We’ll have to see. YMMV.