...
It is recommended to run project analysis analyses on a regular basis to get the best from the Sonar SonarQube platform. Continuous Integration servers are the perfect tools to do so.
...
Jenkins
Install and configure the Sonar SonarQube Jenkins plugin for Hudson / Jenkins.
Hudson
Install and configure the SonarQube Hudson plugin.
Atlassian Bamboo
Install the Sonar SonarQube plugins for Bamboo, by Marvelution.
...
The difficulty in Continuum is to be able to synchronize an install goal with the sonar:sonar goal because it is necessary that an install command goal is run before the Sonar SonarQube 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 two options: either running install commands goals regularly (for example every hour), or trigger a complete command such as:
| Code Block |
|---|
mvn clean install sonar:sonar -Dmaven.test.failure.ignore=true |
| Note |
|---|
in In this case, unit test tests are going to be run twice: once during |
In case you decide to run install commands regularly, here is the setup you can do for the sonar SonarQube build:
- Create a build definition with the goal:
| Code Block |
|---|
sonar:sonar
|
For multi-module projects, make sure that the --non-recursive build definition argument is NOT set.
- Once created, run this build definition on the root pom of the projects you want to sonarSonarQube.
- For multi-module projects, make sure to check For multi modules project, load only root as recursive build when you create the project through the Continuum maven Maven 2 wizard
CruiseControl
In CruiseControl, use the | to run the install and the sonar:sonar goals in two different processes.
The command to be launched run should look like:
| Code Block |
|---|
clean install -Dtest=false -DfailIfNoTests=false | sonar:sonar -Psonar_profile |
...
- In general settings, make sure that fail build if at least one test failed is unchecked.
In build runner config, select Maven2, with the goal
No Format clean install sonar:sonar
Additional maven Maven command line parameters:
No Format -Dmaven.test.failure.ignore=true
- In build triggering select a daily schedule (or what you prefer).
- In Properties and environment variables, add an environment variable called MAVEN_OPTS, and set the value to '
-Xmx512m'

