Monday, November 2, 2009

how to setup clover with multi-module maven project and build with bamboo

Ok so i figured how to setup clover with maven on a mulit-module project with putting the config in a maven profile:

<profile>
<id>clover</id>
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-clover2-plugin</artifactId>
<configuration>
<targetPercentage>${clover.coverage.percent}</targetPercentage>
<snapshot>/development/build-server/clover/${groupId}-${artifactId}/clover.snapshot</snapshot>
<generateHtml>true</generateHtml>
<generateXml>true</generateXml>
<baseDir>${project.basedir}</baseDir>
<licenseLocation>/development/build-server/clover/clover.license</licenseLocation>
</configuration>
<executions>
<execution>
<id>clover</id>
<goals>
<goal>setup</goal>
<goal>snapshot</goal>
</goals>
</execution>
<execution>
<phase>verify</phase>
<goals>
<goal>aggregate</goal>
<goal>clover</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</build>
</profile>


Simply drop that into your profiles section in your pom. You will need to change the paths of where you have put your clover licence and where you want the snapshots to be stored. Then when you want to run it use this command.

mvn -P clover install


Bamboo

Setup bamboo as normal but make sure you don't let bamboo clear out your build directory each time or clover won't work. So untick the option to clean out the build directory each time.

3 comments:

Anonymous said...

A year after and Atlassian's documentation still doesn't cover this... Good job.

Curious Attempt Bunny said...

Ouch! Maven?

Anonymous said...

what phase is the first execution, with id=clover, bound to?