Hello there,
Sonarqube Server (Community Edition): 7.9.2.30863/8.2.0.32929 or SonarCloud
- with JaCoCo plugin 1.0.2 (build 475) installed
- with SonarJava plugin 6.1 (build 20866) installed
Gradle: 6.2.1
- Kotlin: 1.3.61
- Groovy: 2.5.8
- Ant: Apache Ant™ version 1.10.7 compiled on September 1 2019
- JVM: 11.0.4 (Oracle Corporation 11.0.4+10-LTS)
- OS: Windows 10 10.0 amd64
build.gradle.kts
plugins {
java
jacoco
id("org.sonarqube") version "2.8"
}
repositories {
jcenter()
}
dependencies {
testImplementation("org.junit.jupiter", "junit-jupiter", "5.6.0")
testRuntimeOnly("org.junit.vintage", "junit-vintage-engine", "5.6.0")
testImplementation("junit", "junit", "4.13")
}
tasks {
test {
useJUnitPlatform()
}
jacocoTestReport {
reports {
xml.isEnabled = true
}
}
}
sonarqube {
properties {
property("sonar.projectKey", "calculator")
property("sonar.host.url", "http://localhost:9001")
property("sonar.sourceEncoding", "UTF-8")
property("sonar.sources", "src/main/java")
property("sonar.tests", "src/test/java")
property("sonar.java.coveragePlugin", "jacoco")
property("sonar.java.binaries", "$buildDir/classes/java/main")
property("sonar.java.test.binaries", "$buildDir/classes/java/test")
property("sonar.junit.reportPaths", "$buildDir/test-results/test")
property("sonar.coverage.jacoco.xmlReportPaths",
"$buildDir/reports/jacoco/test/jacocoTestReport.xml")
}
}
Running Gradle build by ./gradlew clean build jacocoTestReport sonarqube --info
Questions:
-
The coverage percentage displayed is about zero. I guess this could be caused by the issue reported back in July 2019 - Java classes with default package.
Do we have any ETA for the bug to be fixed? Do we know any workaround except moving the source code to a package? -
With the above mentioned Sonarqube configuration where “new”
sonar.coverage.jacoco.xmlReportPaths
andsonar.junit.reportPaths
are using, I still see the warnings about obsolete properties:
Property 'sonar.jacoco.reportPath' is no longer supported. Use JaCoCo's xml report and sonar-jacoco plugin.
Property 'sonar.jacoco.reportPaths' is no longer supported. Use JaCoCo's xml report and sonar-jacoco plugin.
Could you suggest any way to fix/skip them? I have another Gradle project with 800+ subprojects in there, which generates 1600+ lines of warning in total.
Any help is highly appreciated.
Thank you!