Monday, May 14, 2007

Buildr

Nope, that's not a typo in the title...

Buildr is a new java application build tool. The fun part is that it's written in Ruby and based on Rake. Rake is an extremely powerful build tool for Ruby applications. There have been a few attempts at adapting it to building Java applications. Most of those attempts were based on the idea of pretending that Java app is really a Ruby app. That principal packs the tool full of workarounds and hacks. Buildr isn't like that at all.

Buildr ties together a few components to build java applications; knowing full well they are java applications. It embraces all of the good ideas behind Maven, without the main bad part: Maven itself. Maven can be very powerful, but that is overridden by Maven being amazingly difficult and unpredictable. The good parts of Maven are the conventions and guidelines around the project directory structures and dependency management via repositories.

I originally discovered buildr through a post at Tim Bray's Ongoing blog. In that post he links to an article by Assaf Arkin. Assaf is one of the folks behind Buildr. Assaf describes his pain with Maven and how they solved it with buildr.

Buildr is still very limited in scope (that's a good thing right now). It doesn't appear to have means of running cobertura for unit test coverage yet. Buildr also lacks an idea task for building Intellij IDEA module files, though it does have an eclipse task. You can see were Assaf's loyalties lie on that one! I'm toying around with writing the idea task myself, but I've got a lot of learning to do in the Rake department. Buildr also doesn't do any of the site generation stuff that Maven can do. This can easily be fixed with a few rhtml templates and ERB.

I toyed with Buildr this weekend for a little bit and was able to get the code for Fizzle (more on that later) to build and publish very easily. You can build multi-component projects with only a single RakeFile at the head of the project. Maven requires a pom.xml in every module. Each repeating various inter-module dependency names and versions all over (bleh). Multi-component stuff is much imporved in Maven2 vs. Maven1, but still hard to approach.

Right off the bat I fell in love with Buildr over Maven for one very simple trick.
The following tests failed:
com.googlecode.fizzle.command.DefaultCommandProviderManagerTest
com.googlecode.fizzle.command.engine.DefaultCommandExecutionEngineTest

Come on Maven, how hard is that? I really don't want to scroll back through 1000+ lines of unit (in Acegi's case) test output to see which one says FAILED. That's ridiculous. I was so inspired by this I stopped everything I was doing to mention it to the buildr folks.

As I said above, Buildr is very light right now. I think overall it has a chance to really be great if it gets enough love. I wonder if we can move Acegi to it, that might be fun :P

Check out Buildr, and discuss it on their google-group.

No comments: