Maven Shell

If you work with Apache Maven at all, you’ve probably checked out the still-unreleased alpha’s of Maven 3. I’ve been working with the alpha-6 for a number of weeks, and I’ve found it solid and reliable, with no changes required to my pre-maven-3 pom file at all.

The only noticeable change is that it’s less chatty to the console, and it runs about 30% faster than before.

I did fall down one hole, but it was a short-lived problem: I was doing something that is arguably not too smart in the first place – that is, calling my “deploy” script on local workstations using a binding to a Maven lifecycle and using the Ant plugin. It turns out the point at which I’d bind to the lifecycle wasn’t well-defined, and Maven 3 had different behaviour in this area than Maven 2. The fix was easy: don’t do that :). I now simply call my ant deploy script manually at the end of the build cycle, using the unix “&&” command, so it only runs if the build succeeded (as I don’t want to deploy the old code if the build of the new didn’t work).

On top of the speed boost I’ve seen with Maven 3, I also tried the very-alpha Maven Shell project, hosted at Sonatype.

This project basically gives you a shell, much like a unix/linux shell, but that is “Maven Aware”. You type your Maven commands just like before, e.g. “mvn clean install”, but the Maven Shell already has an instance of Maven loaded, so execution begins faster, and it caches POMs and such, so the runtime even beyond startup is faster still. I was able to take a 2+ minute build cycle (on an old, tired laptop) and take it down to 30 seconds, by using both Maven 3 and the Maven Shell.

Not bad, not bad at all.

Published: March 29 2010

  • tags: