Dashboard > CruiseControl > Home > CruiseControlWithMaven2
CruiseControlWithMaven2 Log In | Sign Up   View a printable version of the current page.

Added by Alexander Schwartz , last edited by David Biesack on Aug 13, 2007  (view change) show comment
Labels: 
(None)

 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:

<plugin name="m2projectCI"
		classname="net.sourceforge.cruisecontrol.ProjectConfig"
		buildafterfailed="false">


	<modificationset quietperiod="60">
		<svn localWorkingCopy="projects/${project.name}" />
	</modificationset>

	<schedule interval="600">
		<maven2 goal="clean | scm:update | deploy" />
	</schedule>


	<listeners>
		<currentbuildstatuslistener />
	</listeners>

	<log> <!-- This includes all test reports of a maven multimodule project. -->
		<merge
			   dir="projects/${project.name}"
			   pattern="TEST-*.xml" />
	</log>

</plugin>

<m2projectCI name="CI__myprojectA">

	<modificationset quietperiod="${quietperiod}">
		<buildstatus logdir="logs\CI__myprojectB" />
	</modificationset>

</m2projectCI>


 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 )

Powered by a free Atlassian Confluence Open Source Project / Non-profit License granted to ThoughtWorks, Inc.. Evaluate Confluence today.
Powered by Atlassian Confluence 2.7.1, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators