It is recommended to run project analysis on a regular basis to get the best from the Sonar platform. Continuous Integration servers are the perfect tools to do so.
Install and configure theĀ Sonar Jenkins plugin.
Install and configure theĀ Sonar Hudson plugin.
Install the Sonar plugins for Bamboo, by Marvelution.
The difficulty in Continuum is to be able to synchronize an install goal with the sonar goal because it is necessary that an install command is run before the Sonar collect starts (See Analyzing Source Code for more information).
Since Continuum does not provide mechanism to trigger a build from a build, there are 2 options: either running install commands regularly (for example every hour), or trigger a complete command such as :
mvn clean install sonar:sonar -Dmaven.test.failure.ignore=true |
in this case, unit test are going to be run twice: once during install and once during sonar |
In case you decide to run install commands regularly, here is the setup you can do for the sonar build:
sonar:sonar |
For multi-module projects, make sure that the --non-recursive build definition argument is NOT set.
In CruiseControl, use the | to run the install and the sonar in two different processes.
The command to be launched should look like :
clean install -Dtest=false -DfailIfNoTests=false | sonar:sonar -Psonar_profile |
These are the build configuration steps you need to do for the build:
In build runner config, select Maven2, with the goal
clean install sonar:sonar |
Additional maven command line parameters:
-Dmaven.test.failure.ignore=true |