Wednesday, October 21, 2009

Test your build with Maven 3

Maven 3 is coming

This post is to show you how to get Maven 3.
Maven 3 is supposed to be drop in replacement of Maven 2.
So you should be able to build your Maven based build with Maven 3 with no problem.
So lets take Maven 3 for a spin.

Getting Maven 3

You can get Maven 3 binaries or build it by hand.

Getting binaries

You can grab binaries from Sonatypes Hudson grid.
Depending on your platform:
Linux
lastSuccessfulBuild from ubuntu
Windows
lastSuccessfulBuild from windows
And extract it to your new M2_HOME.

Building from source

Check it out, and build:
$ svn co http://svn.apache.org/repos/asf/maven/maven-3/trunk maven-3
$ cd maven-3
$ export M2_HOME=/your/new/m3/home/
$ ant
So you have your own build of Maven 3 at /your/new/m3/home/. Congratulations!

Add to path

Independently how you got your new Maven 3, you need to add M2_HOME/bin to your PATH environment variable.

Start using it

And that is it, you have Maven 3.
As verification step execute, end expect something similar:
$ mvn -version
Apache Maven 3.0-SNAPSHOT (r828135; 2009-10-21 20:46:19+0200)
...
You probably will see quite some warnings while building your projects that previously where unnoticed.
Following those instructions will improve your build.
Enjoy your new build tool!