Reader Nacho Coloma got me thinking. A few weeks ago he mentioned Gradle as an alternative for Maven. Now I’m not ready to throw out Maven, but the alternatives are at least interesting. Most popular alternatives have one thing in common: they shy away from XML in favor of domain specific languages (DSLs). Those DSLs are in many cases a subset of some of the more popular scripting languages.
Read on for more about Gradle, Gant, Rake, Raven and Buildr.
Groovy Ant scripting, no dependency management or extras.
If you’re still used to Ant build files and presumably doing most of the dependency management by hand, than Gant is probably a great choice for you. It hides the Ant XML that can become very unwieldy and syntax heavy in favor if more focussed Groovy.
That’s all there is to it. And that’s the attraction.
An up-and-coming star in the build world. Groovy, Ant and Ivy combined.
Wherever you go, Gradle is on the lips of many developers. Aaron explains it a lot better, but if you like the Groovy syntax and want a little more substance to your build tool than Gant, this might be your best choice.
The result are very small, condensed build files. Reading them feels natural, most of the things I see in the documents, I can guess what it will do. I’m not sure if writing the files is just as easy (but than again, Maven is difficult both reading and writing the files)
Personally, I must confess, that I found Rake the most inaccessible of the bunch of tools I describe here. I’m sure it’s not because of the documentation (there is a lot and most of it pretty clear). Even Martin Fowler seems to like it, although the linked document is fairly old.
I think it’s because Rake files are not only written in Ruby, but it’s also very focused on Ruby development. I haven’t really developed much in Ruby, so I think that’s why some of the most basic constructs look slightly outlandish to me.
I also didn’t look too deep, because if you want to use Ruby to build Java, there are better options.
Java building with Rake
As the site proclaims, this is really Rake adapted for Java building. It further combines this with Ruby Gems. At its most basic, you could compare this with Maven’s dependency management. In fact, there is an adapter available that allows you to convert a Maven repository to a Ruby Gem one.
Raven has specific tasks for Java development (javac, war, etc.) which makes it easier to use than plain Rake.
Ruby Java building with Maven repositories
Buildr is the second Rake spin-off for Java development. For me, it has one major advantage, it uses the Maven repositories directly and also has the “Maven style” of specifying dependencies (group, artifact, version, scope). Buildr claims on the front page, it’s a drop in replacement for Maven. That is a very powerful selling point.
Buildr too is built on Rake, so it’s pure Ruby, which will take a little getting used to. However loosing the endless xml-tags is something you’ll probably get used to right-away.
I think I summed up the most important innovations in Java building, as always, please correct me! If you like Groovy, I’d suggest Gradle. If you prefer Ruby, go for Buildr (especially if you already have Maven repositories set up). But mind you, none of the others are bad choices, they just serve slightly different purposes than what I am currently looking for in a build tool.
Feel free to use the comments and share your personal preferences.