Saturday, November 8, 2008

Cruisecontrol and Maven2

<!-- Load environment variables -->
<property environment="env" toupper="true"/>

<!-- Commonly used directories -->
<property name="project.dir" value="projects/${}"/>
<property name="log.dir" value="logs/${}"/>

<!-- Defaults for email -->
<property name="" value=""/>
<property name="" value="Matt Raible"/>

<!-- CruiseControl settings -->
<property name="interval" value="1800"/>
<property name="build.server" value=""/>

<!-- Preconfigure our plugins -->
<plugin name="currentbuildstatuslistener" file="${log.dir}/status.txt"/>
<plugin name="currentbuildstatuspublisher" file="${log.dir}/status.txt"/>
<plugin name="svn" localWorkingCopy="${project.dir}"/>

<plugin name="htmlemail"
subjectprefix="[CruiseControl] " css="webapps/cruisecontrol/css/cruisecontrol.css"
xsldir="webapps/cruisecontrol/xsl" logdir="logs/${}"
mailhost="localhost" defaultsuffix="" reportsuccess="fixes"
returnaddress="${}" returnname="${}"/>

<plugin name="email"
subjectprefix="[CruiseControl] " reportsuccess="always"
mailhost="localhost" defaultsuffix=""
returnaddress="${}" returnname="${}"/>

<project name="appfuse-2.x">

<svnbootstrapper localWorkingCopy="projects/${}" />


<schedule interval="${interval}">
<maven2 mvnhome="${env.M2_HOME}" pomfile="projects/${}/pom.xml" goal="clean scm:update install"/>

<merge dir="projects/${}/data/common/target/surefire-reports"/>
<merge dir="projects/${}/data/hibernate/target/surefire-reports"/>
<merge dir="projects/${}/data/ibatis/target/surefire-reports"/>
<merge dir="projects/${}/data/service/target/surefire-reports"/>
<merge dir="projects/${}/web/common/target/surefire-reports"/>
<merge dir="projects/${}/web/common-war/target/surefire-reports"/>
<merge dir="projects/${}/web/jsf/target/surefire-reports"/>
<merge dir="projects/${}/web/spring/target/surefire-reports"/>
<merge dir="projects/${}/web/struts/target/surefire-reports"/>
<merge dir="projects/${}/web/tapestry/target/surefire-reports"/>

<artifactspublisher dest="artifacts/${}" dir="${env.HOME}/.m2/repository/org/appfuse"/>

<email><always address="${}"/></email>
Continuum vs. CruiseControl for Maven 2 (from Raible Designs)

I spent some time this past weekend getting automated builds setup for AppFuse 2. Since the project now uses Maven 2, I figured I'd give Continuum a try. I pointed it at my pom.xml in SVN and expected everything to work out-of-the-box. No dice. It seems that Continuum reads the artifactIds instead of the module names for sub-project resolution. To workaround this issue, I'd basically have to rename all my sub-projects to have an "appfuse-" prefix. Doesn't that violate the whole DRY principle? Sure, there's projects that do this, but there's others that don't.

Since I didn't feel like renaming the modules/directories in SVN, I gave CruiseControl a try instead. It took a bit of elbow grease on my part, but I ended up with a config.xml file that works splendidly. It seems somewhat ironic to me that the CruiseControl works better with Maven 2 than Continuum does.

1 comment:

Anonymous said...

All I can say is thanks. This was a great example - there simply aren't enough of these (easily) available on the web without having to fight through all sorts of data and details that are irrelevant