Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 20 Next »

Table of Contents

Icon

Triggering a Sonar Analysis on a Maven Job

On a Maven job, go to the 'Post-build Actions' section and click on 'Add post-build action':

Then configure this post-build action:

  • Choose the 'Sonar Installation':

  • Fill in the 'Advanced...' parameters:
     

Parameters:

Properties

Description

Sonar InstallationThe Sonar installation to use. To manage Sonar installations, see Configuring Sonar Jenkins Plugin.

Branch

The sonar.branch property. See Analysis Parameters for more information.

Language

The language of the source code (sonar.language).

MAVEN_OPTS

The parameters used by Maven such as -Xmx512m

JDKThe JDK to use for the Sonar analysis (by default, it is inherited from the job).

Additional properties

Additional properties can be set. See Analysis Parameters for detailed documentation on these additional properties.

Don't use global triggers configurationIf checked, overrides the default trigger actions set at Sonar installation level. See Configuring Sonar Jenkins Plugin for detailed documentation on these parameters.

Triggering a Sonar Analysis on a Non-Maven Job

If you are not using the Maven build process, you can still use this plugin to activate the analysis.

On your project add a Build step :

Then configure it :

The parameters are :

Paramater

Explanation

Path to project properties

Relative path of the properties file.

Project properties

Here you can set the properties without the need of the properties file. The values here will will take precedence over the ones defined eventually in the project properties file

JVM_OPTIONS

Allow to set the JVM parameters used the Sonar Runner when it will be executed

The properties are :

Properties

Mandatory

Explanation

sonar.projectKey

yes

The key used to identify a project

sonar.projectName

yes

The name of the project

sonar.projectVersion

yes

The version of the project

sources

yes

A comma separated list of source directories

tests

no

A comma separated list of test directories

binaries

no

A path to the project binaries

libraries

no

A path to the project libraries

sonar.java.source

no

1.5 or 1.6 to turn up some features available on 1.5 or 1.6

sonar.java.target

no

1.5 or 1.6 to turn up some features available on 1.5 or 1.6

sonar.language

no

The language to analyze (default: java)

my.property

no

Some other properties

This Build step will launch the Sonar Runner.

Activate Sonar analysis by Ant task

This plugin is useless if you are using the Ant task to define analysis of your projects.
Indeed all the information about the Sonar server will be defined in your Ant build file as explained here.

  • No labels