Friday, January 4, 2008

Back to Maven, No to Raven and BuildR

One of the TODOs I set for this year is to find out more about Raven -- a Java build tool written in Ruby. The rationale behind such tool is that it provides you with a full scripting environment, unlike the XML-config-based Ant and Maven. With that, you won't miss any tiny single things that you need for your build -- it can go beyond the boundaries. With the latter, you will have to write Ant task or Mojo (do you miss Jelly?).

Half way through, I switched to BuildR -- just another build system written in Ruby, an Apache incubator project. One of the similarities of Raven and BuildR is they are both written on top of Rake -- the Ruby 'Make'. I found it out from the source of Apache Ode actually.

I have gone through some pain in the past 3 days in converting one of my projects (the Mule JXTA transport) from Maven 2 (pom.xml) to BuildR (Rakefile), such as,
  • Couldn't to connect to the project's repository, as HTTPS and Basic AUTH are unsupported. I have submitted a patch to the BuildR folks at BUILDR-14.
  • Couldn't get my existing test cases to run, BuildR only considers "Test*" and "*Test" cases as valid JUnit test cases. You can fix this by modifying the test.rb of it.
  • Transitive dependency management! People love and hate Maven because of this feature. It is currently not supported by BuildR 1.x (scheduled in 2.x I guess). And has Raven implemented it? I'm not sure but I came through an interesting blog by Matthieu Riou which concludes to add this feature into Raven. Without it, I had to fill in all the dependencies into my Rakefile by referring to the classpath files generated by Maven. How ironic.
IMO, these Ruby build tools are not as mature as Maven and it requires more scripting work to do what Maven can do for me at this stage, e.g. assembly, release, etc. I will also quote what David told me, which makes a lot of sense but could be controversial especially to some Makefile/Rakefile folks:

"Why do you have to write code to build your code? You will end up doing more debugging."


So that's a no-no. The de-facto build tool has got to be Maven.

- yc

3 comments:

Yuen-Chi Lian said...

I also think that an XML (eXtensible markup language) is very extensible. Any application can read a POM and extract its contents, but a Rakefile in this case..

yc

Ittay Dror said...

About "why write code to build..":
Sometimes writing configurations that some container reads and acts upon works. Sometimes it doesn't. If it worked always, we wouldn't be writing code to build any software.
The fact is that building a complex project requires imperative actions. I recently built a project and fought with the assembly plugin for a week until giving up and writing ant code to do what I needed. The same happened to glassfish (http://blogs.sun.com/psterk/entry/introducing_maven_antrun_extended_plugin)
I think buildr combines both declerative syntax ("compile.with project('another-module'), 'jaxen:jaxen:jar:1.1.1'") and a way to use a real language when you need.

Ittay Dror said...

I also found that I had to debug the pom.xmls a lot: find typos, that i needed to use a property somewhere, how profiles were merged, why pluginManagement didn't work as i expected etc. of course, there is no debugger, not even print-debugs, so it was just using help:effective-pom, and sometimes going to the mojo, adding a print debug there and seeing what happened. all more painful than had i used regular code (even in ant things are easier)