Symptoms
Multi-module Maven build on Bamboo with automatic Clover integration. Generation of history reports enabled.
Build failing on a sub-module with an error like below:
/tmp/MY-JOB1/mvn6923231521105500978resource:21: java.lang.IllegalStateException: basedir /home/bamboo/xml-data/build-dir/MY-JOB1/my-module/.cloverhistory is not a directory
Cause
When automatic Clover integration with historical reports is enabled in Bamboo, the Bamboo adds a following parameter to a Maven build task:
-Dmaven.clover.historyDir=.cloverhistory
As a consequence, in case of sub-modules, it cannot find a directory containing historical data, because it's located in the top-level module.
Resolution
The best way to use Clover with Bamboo and Maven to create historical charts is:
- use a single clover database for all modules, rather than 1 per module
- this removes the need to call clover:aggregate
- use -Dmaven.clover.singleCloverDatabase=true
- specify a single historydir location: -Dmaven.clover.historyDir=/some/dir/notdeleted-across-clean-builds
- this location must be preserved between bamboo builds
- if you have multiple bamboo agents, be sure to capture the contents of this dir somehow and make it available for the next build.
- use manual Clover integration, otherwise mvn command will have two -Dmaven.clover.historyDir options provided (one defined manually, one added by Bamboo) - bug BAM-13222