Using CruiseControl With Maven2
Although the Maven community suggests to use the combination of Maven 2 and Continuum, it is a common choice to run CI or scheduled builds of Maven2 projects with CruiseControl.
Building Development Snapshots
Maven uses a lot of conventions to simplify the configuration management ("convention over configuration"). For the following description we assume you use the standard maven convention concerning version numbers: In the development phase of a project (say we develop "1.6.0" of "myproject") its version number is set to next release version with the suffix "-SNAPSHOT" (in our case "1.6.0-SNAPSHOT").
One possible choice of building development snapshots of maven2 projects is to use two different builds:
- CI builds --- a binary build, that is, the main artifact is build & deployed in your inhouse snapshot repository
- nightly builds --- a full build including building & deploying the web site of the project
CI Builds (of Development Snapshots)
We assume that your project is in development phase and that it has a SNAPSHOT version number.
To perfom a clean full binary build the following maven goals should be executed:
- clean --- to remove the output of the previous build
- scm:update --- to get the latest changes from SCM
- deploy --- to execute the full build life cycle of maven until the artifact is deployed.
The CC maven2 builder you use specify the goal as "clean | scm:update | deploy" to force three separate runs of maven2.
Compare http://cruisecontrol.sourceforge.net/main/configxml.html#maven2
To have just the build of one project trigger another
project to build you can use the <buildstatus> tag in the <modificationset>.
Another option is to use <maven2snapshotdependency> in the <modificationset>. The Maven2SnapshotDependency modification set is designed to detect new builds of maven snapshots and treat them similarly to source code changes for the m2 project that depends on them.
Example:
Nightly Builds (of Development Snapshots)
To configure a nightly build of a maven2 project rather than a CI build you have to make two modifications to the CI build configuration:
- Use a fixed build time rather than any build triggers.
- Add an additional goal "site-deploy"
Building Release Versions
to be done...
Links
Jerome Lacoste gave a talk "Cruisecontrol with Maven 2" at BeJUG 2006. (PDF )