Friday, January 11, 2008

Exercise: Continuum

Today's article is going to be a step by step on getting a pretty hefty Maven based project up and running on your machine. I will finish by having the project set up in Eclipse of better development. The project is Continuum. It is a continuous integration server created by the Maven community.

We will start by checking out Continuum. Use this command to get the project from Subversion:

svn checkout http://svn.apache.org/repos/asf/maven/continuum/trunk/ continuum

Once you have the project downloaded 'cd' on over into it. Do a ls or dir command. You will now find you are looking at a multi-module Maven project! Egads thats a different sight in comparison to a non-multi-module project. Well lets kick things off by running:

mvn install -Dmaven.test.skip

We don't want to test, for now. You will need to run install so that each module's artifact (jar) gets put into your local repo. This is important because a module can rely on artifacts created by other modules, and so the artifacts must be available via repo. This will take a bit, Continuum is fairly big. Once things are done you will want to prep Continuum for Eclipse. Run the command:

mvn eclipse:eclipse

This will go into each module and create the Eclipse meta files, so that you can import them into Eclipse no problems.

We now are at the last step. Open up Eclipse, right click in the 'package manager' view (window). Select 'import'. This pops up a window, select 'general > existing projects into workspace'. Point to the folder containing all the modules and click ok. You will notice Eclipse finds a project for each module. Click ok. After a bit of grunting Eclipse will present you will a view full of projects, one for each module.

At this point you may need one last thing. If you do not have the M2_REPO Eclipse you will need to set it. Check the 'problems' view, if you see a bunch of messages about this not being set... bingo. Go into preferences then "java > build path > classpath" and add the var, giving it a value of the location of your local repo. Mine is "/home/ottaway/.m2/repository".