Wednesday, 8 April 2009

To Maven or not to Maven

In a recent project, I was mandated to use Maven for a build tool. Since then, I've heard a lot of questions about whether or not Maven is worth migrating to. Here's my take on that, but my experience with Maven is limited to the last 5 months.
If you are using an Apache foundation project, using Maven is a no-brainer since Maven is under the Apache umbrella too. The newer Apache projects such as CXF (for web services), Camel and ServiceMix have excellent support for Maven. Support for Maven at basic, means that a project's jars are available under the Maven repository. ServiceMix has support for creating new archetypes, which a Maven concept of a template for a project.
Web application projects which are the bread and butter of a Java developer are well supported by Appfuse. It took me a while to actually understand what Appfuse did, and after some poking around (I might be wrong here), it appears to a tool that creates a template for a "standard" application. By "standard" I mean that an application stack, say "Hibernate+Spring+Webwork" needs certain artifacts in certain places, and Appfuse simplifies the job for you. The Appfuse archetypes page lists the common stacks, which is usually Spring framework along with Struts2/Apache Wicket/JSF/Tapestry providing the MVC.
Spring framework itself plays well with Maven. Most of its jars (the sub projects as well) are in the Maven Repository and updated quite often. It doesn't offer any archetypes to create specific projects though.
Under the Eclipse framework umbrella where OSGI is the reigning buzzword, Maven is probably not a good choice. Late in 2008 when I tried to build my Eclipse EMF sources to Maven, I simply had to give up at some point. The maven dependency resolution mechanism didnt work with OSGI jars, and having built EMF generated sources in Eclipse, I found it hard to simply move all of that away to Maven. The default EMF generated sources also have imports from the org.eclipse.* package which are in OSGI jars, and that doesn't help again.
Perhaps OSGI jars can and will coexist with other jars in the Maven repository, at that point using Maven makes sense.
IDE support:
Although Eclipse IDE doesn't have great support for Maven, a couple of Eclipse plugins such as m2eclipse (and another that I dont recall) can be used. The plugin allows one to import a Maven project, search and update dependencies and the other day to day operations. However, there are times when the IDE just refuses to organize its imports properly.
Netbeans and Maven pretty much worked out of the box for us. It was able to import a Maven project, build ,organize depencies and the rest quite smoothly.

Java on the Google App Engine

The news is just out that Java is the second language to be available on the Google App Engine. This immediately challenges Amazon EC2's hegemony for the cloud. Python was probably seen as the biggest negative for GAE, and that is now out of the way.
Here's a rather simplistic head-to-head of the EC2 vs GAE.