Groovy Documentation

org.gradle.api.sonar.runner
[Groovy] Class SonarRunnerExtension

java.lang.Object
  org.gradle.api.sonar.runner.SonarRunnerExtension

@Incubating
class SonarRunnerExtension

An extension for configuring the Sonar Runner. The extension is added to all projects that have the sonar-runner plugin applied, and all of their subprojects.

Example usage:

 sonarRunner {
     skipProject = false // this is the default

     sonarProperties {
         property "sonar.host.url", "http://my.sonar.server" // adding a single property
         properties mapOfProperties // adding multiple properties at once
         properties["sonar.sources"] += sourceSets.other.java.srcDirs // manipulating an existing property
     }
 }
 


Property Summary
boolean skipProject

Tells if the project will be excluded from analysis.

 
Method Summary
void evaluateSonarPropertiesBlocks(Map properties)

void sonarProperties(Action action)

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

 
Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Property Detail

skipProject

boolean skipProject
Tells if the project will be excluded from analysis. Defaults to false.


 
Method Detail

evaluateSonarPropertiesBlocks

@PackageScope
void evaluateSonarPropertiesBlocks(Map properties)


sonarProperties

void sonarProperties(Action action)
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.

Parameters:
action - an action that configures Sonar properties for the associated Gradle project


 

Gradle API 1.8