We rewrote an app from Java to Kotlin, and now Sonar says 0% code coverage for the app, while Jacoco HTML says 58%. Any ideas on how to resolve?
ALM used: GitLab
CI system used: Jenkins
Scanner command used when applicable: ./gradlew -DtestBuildType=debug app:jacocoTestReport; ./gradlew sonar
apply plugin: “org.sonarqube”
sonar {
properties {
property “sonar.projectKey”, “…”
property “sonar.organization”, “…”
property “sonar.host.url”, “https://sonarcloud.io ”
property “sonar.c.file.suffixes”, “-”
property “sonar.cpp.file.suffixes”, “-”
property “sonar.objc.file.suffixes”, “-”
property “sonar.coverage.jacoco.xmlReportPaths”, “build/reports/jacoco.xml”
}
}
Languages of the repository: Android Java, Kotlin
Version of Gradle plugins:
org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:4.0.0.2929
org.jacoco:org.jacoco.core:0.8.8
Thanks
Best regards
Arne
ganncamp
(G Ann Campbell)
July 11, 2023, 2:51pm
2
Hi Arne,
Welcome to the community!
Can you post your analysis log?
The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.
This guide will help you find them.
Ann
1 Like
Hi G. Ann, sorry for late reply caused by vacation & funeral.
This week we found out the reason why we got 0% coverage of the Kotlin Android app, the class path is different for Java and Kotlin:
Java: “${buildDir}/intermediates/javac/debug/classes”
Kotlin: “${buildDir}/tmp/kotlin-classes/debug”
After adding the class path for Kotlin as above, got code coverage. So issue is resolved now, thanks.
Best regards,
Arne
1 Like
system
(system)
Closed
September 6, 2023, 12:57pm
4
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.