| Info | ||||
|---|---|---|---|---|
This page documents how to trigger a Sonar analysis from a Jenkins job for versions 2.0+. For versions prior to 2.0, browse this documentation page. | ||||
| Info | ||||
| ||||
|
...
Configure the Sonar analysis:

Parameters:
...
Properties
...
Description
...
Mandatory.
Sonar installation to use.
To manage Sonar installations, see Configuring Sonar Jenkins Plugin.
...
Mandatory.
Sonar Runner to use to launch the analysis.
To manage Sonar Runners, see Configuring Sonar Jenkins Plugin.
...
Project properties
...
Mandatory if 'Path to project properties' is not set.
The properties of the Sonar analysis. The properties defined here will override the ones defined in the project properties file.
| Code Block | ||
|---|---|---|
| ||
# required metadata
sonar.projectKey=my:project
sonar.projectName=My project
sonar.projectVersion=1.0
# path to source directories (required)
sonar.sources=srcDir1,srcDir2
# path to test source directories (optional)
sonar.tests=testDir1,testDir2
# path to project binaries (optional), for example directory of Java bytecode
sonar.binaries=binDir
# optional comma-separated list of paths to libraries. Only path to JAR file and path to directory of classes are supported.
sonar.libraries=path/to/library.jar,path/to/classes/dir
# The value of the property must be the key of the language.
sonar.language=cobol
# Additional parameters
sonar.my.property=value |
See Analyzing with Sonar Runner for detailed information on configuring a Sonar analysis with the Sonar Runner.
...
. You can either point to an existing sonar-project.properties file or directly set the analysis properties in the 'Project properties' field:

Triggering a Sonar Analysis with Maven
On a Maven job, go to the 'Post-build Actions' section and click on 'Add post-build action':
...
- Fill in the 'Advanced...' parameters:

Parameters:
Properties | Description |
|---|---|
| Sonar Installation | Mandatory. |
Branch | Optional. |
Language | Mandatory. |
MAVEN_OPTS | Optional. |
| JDK | Optional. The JDK to use for the Sonar analysis (by default, it is inherited from the job). |
Additional properties | Optional. |
| Don't use global triggers configuration | If checked, overrides the default trigger actions set at Sonar installation level. |

