@Incubating class SonarRunnerPlugin
A plugin for analyzing projects with the
Sonar Runner.
When applied to a project, both the project itself and its subprojects
will be analyzed (in a single run). Therefore, it's common to apply the
plugin only to the root project. To exclude selected subprojects from
being analyzed, set sonarRunner.skipProject = true.
The plugin is configured via SonarRunnerExtension. Here is a small example:
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
}
}
The Sonar Runner already comes with defaults for some of the most important
Sonar properties (server URL, database settings, etc.). For details see
Analysis Parameters
in the Sonar documentation. The sonar-runner plugin provides the following additional
defaults:
java-base plugin applied, additionally the following defaults are provided:
java plugin applied, additionally the following defaults are provided:
rt.jar added if necessary)
| Type | Name and description |
|---|---|
Project |
targetProject |
| Type | Name and description |
|---|---|
void |
apply(Project project) |
void |
computeSonarProperties(Project project, Properties properties) |