Clover fails to load a license in Bamboo
Symptoms
Clover used with Bamboo. Clover license key pasted on the global configuration page (Bamboo > Administration > Plugins > Clover Plugin > License).
Automatic Clover integration used for Maven-based build job. Build fails with an error like this:
[ERROR] Failed to execute goal com.atlassian.maven.plugins:maven-clover2-plugin:3.1.8:setup (default-cli) on project MYPROJECT:
Failed to load resource as file [/opt/atlassian/bamboo-data/xml-data/build-dir/MYPROJECT-JOB1/.clover/clover.license]: Permission denied -> [Help 1]
or
[ERROR] Failed to execute goal com.atlassian.maven.plugins:clover-maven-plugin:4.1.1:setup (default-cli) on project MYPROJECT:
Failed to load resource as file [/opt/atlassian/bamboo-data/xml-data/build-dir/MYPROJECT-JOB1/.clover/clover.license]: Permission denied -> [Help 1]
Cause
Clover was unable to create a temporary file in java.io.tmpdir.
Resolution
Check value of java.io.tmpdir. Check permissions to this directory.
You can find current value of java.io.tmpdir in a Bamboo build log - look for "mvn" command line, for instance:
[...]
Finished task 'Checkout Default Repository'
Running pre-build action: Build Number Stamper
Running pre-build action: Clover Grails PreBuild Action
Running pre-build action: VCS Version Collector
Running pre-build action: Repository Isolation Enabler Action
Running pre-build action: Maven Settings Prebuild Action
Starting task 'MyProject' of type 'com.atlassian.bamboo.plugins.maven:task.builder.mvn3'
Beginning to execute external process for build 'MyProject - HEAD - Default Job'\n ... running command line: \n
/opt/maven/bin/mvn\n -Djava.io.tmpdir=/tmp/MYPROJECT-JOB1\n
clean\n install\n clean\n
com.atlassian.maven.plugins::clover-maven-plugin:setup\n
verify\n
com.atlassian.maven.plugins::clover-maven-plugin:aggregate\n
com.atlassian.maven.plugins::clover-maven-plugin:clover\n
-Dmaven.clover.generateJson=false\n
-Dmaven.clover.licenseLocation=/opt/atlassian/bamboo-data/xml-data/build-dir/MYPROJECT-JOB1/.clover/clover.license\n ...
in: /opt/atlassian/bamboo-data/xml-data/build-dir/MYPROJECT-JOB1\n ...
using extra environment variables:
[...]
[INFO] Scanning for projects...