Saturday, November 8, 2008

Cruisecontrol and Maven2

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

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

<!-- Defaults for email -->
<property name="buildmaster.email" value="matt@raibledesigns.com"/>
<property name="buildmaster.name" value="Matt Raible"/>

<!-- CruiseControl settings -->
<property name="interval" value="1800"/>
<property name="build.server" value="home.raibledesigns.com:8280"/>

<!-- 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"
buildresultsurl="http://${build.server}/buildresults/${project.name}"
subjectprefix="[CruiseControl] " css="webapps/cruisecontrol/css/cruisecontrol.css"
xsldir="webapps/cruisecontrol/xsl" logdir="logs/${project.name}"
mailhost="localhost" defaultsuffix="@dev.java.net" reportsuccess="fixes"
returnaddress="${buildmaster.email}" returnname="${buildmaster.name}"/>

<plugin name="email"
buildresultsurl="http://${build.server}/buildresults/${project.name}"
subjectprefix="[CruiseControl] " reportsuccess="always"
mailhost="localhost" defaultsuffix="@dev.java.net"
returnaddress="${buildmaster.email}" returnname="${buildmaster.name}"/>

<project name="appfuse-2.x">
<listeners><currentbuildstatuslistener/></listeners>

<bootstrappers>
<svnbootstrapper localWorkingCopy="projects/${project.name}" />
</bootstrappers>

<modificationset><svn/></modificationset>

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

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

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

<currentbuildstatuspublisher/>
<email><always address="${buildmaster.email}"/></email>
</publishers>
</project>
</cruisecontrol>
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

Google+