Ant Build Templates: Prelude

I’ve long been an Ant enthusiast and advocate for its use beyond simple Java compilation tasks. A while back, I wrote a post, available in my InstantSpot archive, describing how I employ Ant to build and deploy web applications. It was intended to be the first in a series, but additional posts just never materialized for a number of reasons. Abort.

In that post, I somewhat casually mentioned that I had created a build template that meets my needs for most projects. More people that I expected caught that casual mention and have asked me to post those templates. I’ve procrastinated in doing so, at least in part, because I didn’t feel like these scripts were ready for public consumption. They were built by me, for me and specifically to meet my needs. Not exactly stellar code, but code that functioned the way I needed it to function.

One of the things I’ve been doing over those past few months of procrastination is editing the script templates that I use. In little snippets of time between then and now, I’ve finally managed to make and test those changes. Not only have I added comments and generally gotten the code to a point where I wouldn’t be mortified to have it go public, but I’ve also tried to make the script a little more robust than the original version(s). I’ve:

  1. Added sanity checks that provide an opportunity to cancel the build before any significant damage gets done.
  2. Added a more robust backup of any existing version that already exists in the deployment environment.
  3. Included a modicum of intelligence so that the script detects its deployment environment and does the right thing based on that environment.
  4. Included a secondary path to handle upgrades in addition to new installs.

All of that said, these are not generic scripts that can be dropped in anywhere. They make a lot of assumptions that may be specific to my environment. The scripts should be (relatively) easily tailored to other environments, but should not be expected to run without modifications. To that end, I’ll build up to revealing the scripts by providing the background information that I think is necessary, important, appropriate or just plain prudent. Some of this has been covered in other posts in the archive, either here on or on InstantSpot, but bear with me. I think it’ll be helpful to have it all in one place and focused.

My goal is to write a post each day on the following topics:

  1. My Environment
  2. My Process
  3. Two Files or One
  4. External Tasks

Once I’ve provided that background, I’ll link the scripts under an MIT license. At any step along the way, I’d certainly appreciate any (constructive) input. I’d like to think that I’ve thought of everything, but I’m old enough to know better.

Subscribe3 Comments on Ant Build Templates: Prelude

  1. Richard Davies said...

    Could you possibly draw it out any longer…? (jk) I’m looking forward to taking a look at the scripts. It sounds like you’ve done some great work and I’m sure I could learn a lot from them.

  2. Rob Wilkerson said...

    I’ll try to post faster. :-) And hopefully the interim information will be useful in some way.

  3. Jim Priest said...

    Looking forward to future posts and some code!!