Report Plugin¶
The plugin configures sonarqube scanner to report code metrics to sonarcloud.io. It makes use of the SonarScanner for Gradle and applies default configuration.
Features¶
This plugin wraps the sonar scanner Gradle plugin and applies some configuration. It also collects project sourceFiles for the report. This works for subprojects and included builds. It also copies code coverage reports to the right location for the scanner plugin.
Installation¶
Add the following to your project root build.gradle/build.gradle.kts
file:
plugins {
id("eu.bitfunk.gradle.plugin.quality.report")
}
The plugin needs some configuration:
- sonarProjectKey: Sonar key used to identify the project.
- sonarOrganization: Sonar organisation name the project belongs to.
- coverageReportSourceDirs: List of directories in which the jacoco coverage report XML file could be found. Default:
buildDir/reports/jacoco/testCodeCoverageReport
reportConfig {
sonarProjectKey.set("sonar project key")
sonarOrganization.set("sonar organization name")
coverageReportSourceDirs.set(listOf("buildDir/reports/jacoco/testCodeCoverageReport")) // Optional
}
Usage¶
To run the report generation and upload to sonarcloud.io:
./gradlew sonarqube
You need to provide a SONAR_TOKEN
from sonarcloud.io to be able to upload reports.