Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3
Info

This page documents how to configure the Sonar Jenkins plugin for versions 2.0+.

For versions prior to 2.0, browse this documentation page.

Info
iconfalse
titleTable of Contents

Table of Contents
maxLevel2

Prerequisites

Configuring the

...

SonarQube Jenkins Plugin

Adding

...

SonarQube Server

You can define as many Sonar servers SonarQube servers as you wish. Then for each Jenkins job, you will be able to choose on which server to run use for the Sonar SonarQube analysis.

To add a Sonar SonarQube server, just follow the three steps below:

1. Log into Jenkins as an administrator and go to Manage Jenkins > Configure System: 



2. Scroll down to the 'Sonar' configuration section and click on 'Add Sonar':


3. Configure your Sonar SonarQube installation:

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

No

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 in the configuration file).

Database driver

Yes

The Java driver classname to be used to connect to the Sonar 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 following 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 this variable is set to true, Sonar analysis will be skipped.

Info

When using trigger exclusions, if you check multiple "Skip if ..." parameters, the build will be skip if at least one of the properties is true (it is an OR condition).

...

Adding SonarQube Runner

This step is mandatory if you want to trigger your Sonar analyses any of your SonarQube analyses with the Sonar SonarQube Runner. Skip this step if you want to trigger all your analyses with Maven.

You can define as many Sonar SonarQube Runner launchers as you wish. Then for each Jenkins job, you will be able to choose with which launcher to use to run the Sonar SonarQube analysis.

To add a Sonar SonarQube Runner, just follow the three steps below:

1. Log into Jenkins as an administrator and go to Manage Jenkins > Configure System: 



2. Scroll down to the 'Sonar Runner' configuration section and click on 'Add Sonar Runner':

Image Removed

3. Click on 'Add Installer' and choose how to install the Sonar Runner, either from:

  • An archive file
  • An installer that will automatically be downloaded from Codehaus
  • By running a command to launch the installer

. It is based on the typical Jenkins tool auto-installation. You can either choose to point to an already installed version of SonarQube Runner (uncheck 'Install automatically') or tell Jenkins to grab the installer from a remote location (check 'Install automatically'):

Image Added