1. Vineet Reynolds
  2. Java EE 6-Galleria

Wiki

Clone wiki

Java EE 6-Galleria / BuildServerIntegration

CruiseControl is used here, for reference, but Jenkins/Hudson or any another CI server could be used instead.

The project is configured in CC as:

<cruisecontrol>
  <project name="JavaEE6Galleria" buildafterfailed="true">
    <listeners>
        <currentbuildstatuslistener file="logs/${project.name}/status.txt"/>
    </listeners>

    <!-- Defines where cruise looks for changes, to decide whether to run the build -->
    <modificationset>
        <mercurial localWorkingCopy="checkout/${project.name}" hgcommand="log" />
    </modificationset>

    <!-- Configures the actual build loop, how often and which build file/target -->
    <schedule interval="60">
		<!-- Call the target that does everything -->
		<composite>
			<!-- Invoke 'hg update' in the CC copy of the Hg repository as the mercurial task in the modification set does not issue 'hg update' (what a bummer) -->
			<exec workingdir="checkout/${project.name}"
			 command="hg"
			 args="update"/>
			<maven2 mvnhome="D:\Apps\apache-maven-3.0.3"
				   pomfile="checkout/${project.name}/pom.xml"
				   goal="clean install" activateprofiles="integration-test" />
		</composite>
    </schedule>

    <!-- directory to write build logs to -->
    <log dir="logs/${project.name}">
        <merge dir="checkout/${project.name}/galleria-ejb/target/surefire-reports" />
        <merge dir="checkout/${project.name}/galleria-ejb/target/failsafe-reports" />
        <merge dir="checkout/${project.name}/galleria-jsf/target/failsafe-reports" />
    </log>

    <!-- Publishers are run *after* a build completes -->
    <publishers>
		<!-- 
        <onsuccess>
            <artifactspublisher dest="artifacts/${project.name}" file="projects/${project.name}/target/${project.name}.jar"/>
        </onsuccess>
		-->
    </publishers>
  </project>
</cruisecontrol>

This assumes that the project was checked out using Mercurial into the checkout subdirectory.

Since the <mercurial> task in CC issues only a 'hg incoming', and does not follow it with a 'hg pull', we have to pull the fresh repository contents ourselves (see the 'exec' element).

A build of the project creates Maven Surefire and FailSafe reports, that can be merged into the build log.

Updated