Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sonarqube + Jacoco - sonar does not read report path from properties

Sonar scanner - 3.1

Java 1.7

I'm trying to configure sonar properties to get coverage from a multi-module project. Coverage is generated under the path: Module/build/jacoco/test.exec, so I wanted to add it to sonar.properties file according to documentation:

https://docs.sonarqube.org/display/PLUG/Code+Coverage+by+Unit+Tests+for+Java+Project

sonar.java.coveragePlugin=jacoco

sonar.jacoco.reportPaths=**/build/jacoco/*.exec

I was trying different combinations even with the absolute path but it seems that sonar-scanner doesn't see this property at all and always looks at default path. I'm always getting information in the logs that:

INFO: JaCoCoSensor: JaCoCo report not found : path\target\jacoco.exec

INFO: JaCoCoSensor: JaCoCo IT report not found: path\target\jacoco-it.exec

It does read other properties from the file like login, password, language, sources etc.

Also, the project is based on Gradle.

like image 776
Lobo Avatar asked Sep 17 '25 04:09

Lobo


1 Answers

If you're building with Gradle, you should Analyze with Gradle. Specifically, there's no need for a sonar-project.properties file. Instead, you configure the SonarQube plugin in your build.gradle, and most of this should just work.

like image 54
G. Ann - SonarSource Team Avatar answered Sep 19 '25 16:09

G. Ann - SonarSource Team