Fun with ant
Since leaving my first job back in 1994, I'd never had a need to use a makefile. Back then I was just doing a little C and C++ work on SCO UNIX and learned enough about 'make' to be dangerous. After that, it was on to VB and no more makefiles. :)
Over the past year, I've had to do a little bit of Java development and I've been using IBM's WebSphere Studio Application Developer. A decent IDE, but nothing like VS.NET. Anyway, I came to a crossroads today. I'm developing code for two different versions of a product -- version 7 and version 8. It was smooth sailing until I ran into three API calls that are totally incompatible between the versions. I wasn't too upset as there was never a promise of compatibility (it is, afterall, a major version number increase). I was going to split the source into two branches and I needed a nice way to handle them at compile time.
Being a .NET guy (but not the .NET Guy) I knew of NAnt and that is was based off of ant, but had never used either. I went to the ant homepage and poked around. It looked interesting, but I only have about 7 source files to compile -- it's pretty basic stuff. So I skipped the download and just whipped up a batch file to do the compiling.
As luck would have it, I was cleaning up our source branches and ran into another issue that needed some tweaking of the batch file. At this point I was still using a single batch file. Then I remembered another issue that only applies to the version 7 branch. Hmmmm.... Perhaps I could use ant afterall. That's when I decided to download ant and spend a bit of time learning it.
It didn't take much time and all to build a nice XML file with all of my build requirements. This also gave me a built-in dependency heirarchy. And I was having so much fun, I cleaned out a couple of other old batch files that I had used for generating WSDL files and JavaDocs.
By the end of the day I had a single XML configuration file that allowed me to:
- Conditionally compile two different targets
- Generate WSDL files for the webservices
- Massage those WSDL files to work with the MS SOAP Toolkit
- Generate JavaDocs of the webservices
Nothing overly complex, but it made my life easier! :)
10:37:46 PM
|