A couple of times a year, I think about starting a new Java project. Usually it’s a tool to automate tasks that I’m tired of doing manually. It often involves parsing a file, or testing a web service, or accessing a database.
For a while I would write it in Ruby, but it was always a pain to distribute. First, you’d have to see if the other user knows what Ruby is, tell them to get it installed, etc. Plus, in my organization, ruby isn’t a supported platform, so these projects never have a chance to get maintained or updated unless I do it.
I’m just enough of an automation geek to think that all projects, even these little ones, need to have a build system. That way if I do want to update it I can do it without having to remember how to set up the class path, etc. And I don’t like using IDEs for builds.
What I really wanted was the convenience of the Rails new project with the acceptance of the Java language. After fiddling around a bit, I decided to write my own.
It’s just one ant file. It creates the directories, compiles the files, and jars them up for you. It keeps old versions of the jars with date-time stamps, but copies the latest version to the build.xml directory so you can easily run it. It can run junit test, and it even includes instructions on how to compile your first code and test classes.
If you need a simple way to start a small Java project, you can check it out.