Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jacoco reports path not found by sonar-runner [duplicate]

I generated a coverage report using EclEmma with the following path :

C:/tmp/coverageReport/report.exec

This file exists, is not empty and is readable. My sonnar-runner configuration regarding code coverage is defined as follows :

sonar.java.coveragePlugin=jacoco
sonar.junit.reportsPath=C:/tmp/coverageReport/report.exec

The analysis completes successfully but no data is visible in the Unit test coverage widget.

Moreover, I get the following lines during the analysis :

18:23:45.036 INFO  - parsing C:/tmp/coverageReport/report.exec
18:23:45.037 WARN  - Reports path not found: C:/tmp/coverageReport/report.exec

Any ideas on what I'm missing ?

like image 555
merours Avatar asked Jan 08 '23 23:01

merours


1 Answers

There is a big difference between sonar.junit.reportPath and sonar.jacoco.reportPath. You are mixing up the values.

Similarly, there's sonar.jacoco.itReportPath (for non-Unit tests based jaocco.exec files for ex: jacocoIT.exec (if you are creating for Integration tests).

Now, Depending upon the version of sonarQube instance (4.x or latest 5.x.x), you may need to set either sonar.junit.reportPath or sonar.java.junit.reportPath to the value (which is the folder containing the .xml data).

For ex: If my Unit tests or Integration tests folder's result files (.xmls) are in folder build/test-results/UT folder, then:

sonar.java.junit.reportPath=build/test-results/UT

or

sonar.junit.reportPath=build/test-results/UT

For the code coverage file (.exec), you have to use:

sonar.jacoco.reportPath=build/jacoco/UT/jacocoUT.exec

or

sonar.jacoco.itReportPath=build/jacoco/IT/jacocoIT.exec

Important - Sonar Properties:

sonar.jacoco.xxx points to the filename.

sonar.junit.xxx or sonar.java.junit.xxx points to a folder name.

sonar.surefire.xxx or sonar.java.surefire.xxx points to a folder name.

Similar to sonar.junit.reportPath, there's also another property called: sonar.surefire.reportPath or sonar.java.surefire.reportPath. Look for Sonar docs for more help under Analyzing Source code with Maven/Gradle.

http://docs.sonarqube.org/display/SCAN/Analyzing+Source+Code (expand it).

For ex: Under Analyze with Gradle build system, look for Configure Analysis Properties section/more.

like image 178
AKS Avatar answered Jan 31 '23 22:01

AKS