Prerequisites
Before configuring Sonar plugin in Jenkins. You need to have :
- running instances of Jenkins and Sonar,
- installed the Sonar plugin and have restarted Jenkins.
Configure Sonar plugin
1. Go the Jenkins configuration :
![]()
2. Scrolldown to Sonar configuration and click on "Add Sonar" :
![]()
3. Configure the different parameters :
![]()
If you have multiple Sonar servers, you can configure as many servers as you want by clicking on "Add Sonar"
List of parameters
Here are the description of the parameters :
Name |
Mandatory |
Description |
|---|---|---|
Name |
yes |
The logical name of the server |
Disable |
no |
Check it if you want to disable this server |
Server URL |
yes |
The URL to access your Sonar server (default to http://localhost:9000). This is the URL used when the analysis will be launched by Jenkins |
Server public URL |
yes |
This is the URL which the user should use to connect to Sonar. If it's not specified the Server URL will be used. |
Database URL |
yes |
The JDBC URL to connect to the database hosting the Sonar database |
Database login |
yes |
The login to connect to the database hosting the Sonar database |
Database password |
yes |
The password to connect to the database hosting the Sonar database the password will be encrypted on the configuration file. |
Database driver |
yes |
The Java driver classname to be used to connect to the database |
Version of sonar-maven-plugin |
no |
If you want to force the use of a specific sonar-maven-plugin, you can set it here. |
Additional properties |
no |
The properties you want to pass to Sonar, you must use the format : -Dsome.property=some.value -Danother.property=another.value |
Skip if triggered by SCM Changes |
no |
If you want to skip Sonar analysis when the Jenkins build is launched by a change in the SCM, check it |
Skip if triggered by the build of a dependency |
no |
If you want to skip Sonar analysis when the Jenkins build is launched by the build of a dependency, check it |
Skip if environment variable is defined |
no |
If the variable set is defined, Sonar analysis will be skipped |
When using trigger exclusions, if you check multiple "Skip if ..." parameters, the build will be skip if at least one of the property is true (it's an OR condition).

