SonarRunnerRootExtension

API Documentation:SonarRunnerRootExtension

Specialization of SonarRunnerExtension that is used for the root of the project tree being analyzed.

This extension provides extra configuration options that are only applicable to the analysis as a whole, and therefore is used for the project (typically the root) that the plugin is applied too.

Example usage:

sonarRunner {
  toolVersion = '2.3' // default

  forkOptions {
    maxHeapSize = '1024m'
    jvmArgs '-XX:MaxPermSize=128m'
  }
}

Properties

PropertyDescription
forkOptions

Options for the Sonar Runner process.

skipProject
Incubating

If the project should be excluded from analysis.

toolVersion

Version of Sonar Runner JARs to use.

Methods

MethodDescription
forkOptions(action)

Configure the SonarRunnerRootExtension.forkOptions().

sonarProperties(action)
Incubating

Adds an action that configures Sonar properties for the associated Gradle project.

Script blocks

No script blocks

Property details

JavaForkOptions forkOptions

Options for the Sonar Runner process.

boolean skipProject

Note: This property is incubating and may change in a future version of Gradle.

If the project should be excluded from analysis.

Defaults to false.

Default:
false

String toolVersion

Version of Sonar Runner JARs to use.

Defaults to 2.3.

Default:
2.3

Method details

void forkOptions(Action<? super JavaForkOptions> action)

Configure the SonarRunnerRootExtension.forkOptions().

void sonarProperties(Action<? super SonarProperties> action)

Note: This method is incubating and may change in a future version of Gradle.

Adds an action that configures Sonar properties for the associated Gradle project.

Global Sonar properties (e.g. database connection settings) have to be set on the "root" project of the Sonar run. This is the project that has the sonar-runner plugin applied.

The action is passed an instance of SonarProperties. Evaluation of the action is deferred until sonarRunner.sonarProperties is requested. Hence it is safe to reference other Gradle model properties from inside the action.

Sonar properties can also be set via system properties (and therefore from the command line). This is mainly useful for global Sonar properties like database credentials. Every system property starting with "sonar." is automatically set on the "root" project of the Sonar run (i.e. the project that has the sonar-runner plugin applied). System properties take precedence over properties declared in build scripts.