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:
- Added sanity checks that provide an opportunity to cancel the build before any significant damage gets done.
- Added a more robust backup of any existing version that already exists in the deployment environment.
- Included a modicum of intelligence so that the script detects its deployment environment and does the right thing based on that environment.
- 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 robwilkerson.org 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:
- My Environment
- My Process
- Two Files or One
- 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.