Setting "sonar.jacoco.reportPaths" to comma-separated list of paths to "jacoco.exec" files, but it just says "JaCoCo report not found"

9,409 views
Skip to first unread message

David Karr

unread,
Jan 31, 2017, 4:07:55 PM1/31/17
to SonarQube
From https://docs.sonarqube.org/display/PLUG/Code+Coverage+by+Unit+Tests+for+Java+Project, I set a command line for the scanner (2.8) setting the "sonar.jacoco.reportPaths" to a comma-separated list of paths to individual "jacoco.exec" files, in my Maven multiproject build.  Unfortunately, the scanner seemed to ignore that and just said "INFO: JaCoCoSensor: JaCoCo report not found : <mycurrentdirectory>\target\jacoco.exec".

Is this documentation page wrong, or does it refer to a different version of the scanner?

What do I have to do to get Sonar to find all of my jacoco.exec files?  Do I instead have to merge them into a single one?

David Karr

unread,
Jan 31, 2017, 4:35:40 PM1/31/17
to SonarQube

I then tried changing the property name to "sonar.jacoco.reportPath" (no "s"), but still a comma-separated list.  This instead says "INFO: JaCoCoSensor: JaCoCo report not found : <mylistofcommaseparatedjacocoexecfiles>".  So that, tells me it's at least looking at the "sonar.jacoco.reportPath" property, but apparently not the "sonar.jacoco.reportPaths" property.  So, either the doc page I reference is wrong, or somehow refers to a different version.

How do I get this done?

Nicolas Peru

unread,
Feb 1, 2017, 2:42:00 AM2/1/17
to David Karr, SonarQube
Hi David, 

What's at play here is not the version of the scanner but the version of SonarJava analyzer you are running : what is that version  ?

Cheers, 

--
You received this message because you are subscribed to the Google Groups "SonarQube" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sonarqube+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sonarqube/2330aca1-2538-497c-a38a-a1b8de50320c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Nicolas PERU | SonarSource
Senior Developer
http://sonarsource.com

David Karr

unread,
Feb 1, 2017, 10:09:37 AM2/1/17
to SonarQube, davidmic...@gmail.com
On Tuesday, January 31, 2017 at 11:42:00 PM UTC-8, Nicolas Peru wrote:
Hi David, 

What's at play here is not the version of the scanner but the version of SonarJava analyzer you are running : what is that version  ?

Is there some default interface in the SonarQube GUI for our local instance that would tell me this?  I don't see any obvious way to find this information.  The output from the scanner seems to just report version info for the scanner itself.
 

David Karr

unread,
Feb 1, 2017, 11:11:32 AM2/1/17
to SonarQube, davidmic...@gmail.com
On Tuesday, January 31, 2017 at 11:42:00 PM UTC-8, Nicolas Peru wrote:
Hi David, 

What's at play here is not the version of the scanner but the version of SonarJava analyzer you are running : what is that version  ?

I'm told we have version 4.4.0.8066 installed.
 

David Karr

unread,
Feb 1, 2017, 6:30:06 PM2/1/17
to SonarQube, davidmic...@gmail.com
On Tuesday, January 31, 2017 at 11:42:00 PM UTC-8, Nicolas Peru wrote:
Hi David, 

What's at play here is not the version of the scanner but the version of SonarJava analyzer you are running : what is that version  ?

Actually, from digging into the SonarJava source code, I found the following block:












 if(sonarQubeVersion.isGreaterThanOrEqual(SQ_6_2)) {
      properties
.add(
       
PropertyDefinition.builder(JacocoConfiguration.REPORT_PATHS_PROPERTY)
         
.defaultValue(JacocoConfiguration.REPORT_PATHS_DEFAULT_VALUE)
         
.category(JavaConstants.JAVA_CATEGORY)
         
.subCategory(subCategory)
         
.name("JaCoCo Reports")
         
.description("Path to the JaCoCo report files containing coverage data by unit tests. The path may be absolute or relative to the project base directory.")
         
.onQualifiers(Qualifiers.PROJECT, Qualifiers.MODULE)
         
.build()
     
);
   
} else {

So the SonarJava analyzer may define the property, but it appears that it's not going to be used unless we're running in SonarQube 6.2 or newer.
 

Nicolas Peru

unread,
Feb 22, 2017, 9:32:46 AM2/22/17
to David Karr, SonarQube
Hi, 

Thanks for your analysis. 
Indeed this property will be available only if your running with SQ API > 6.2. I have updated the documentation to make that appear. 

Thanks for the feedback.


For more options, visit https://groups.google.com/d/optout.

santho...@gmail.com

unread,
Dec 20, 2017, 1:11:04 AM12/20/17
to SonarQube
Hi Nicolas Peru,

I have multiple jacoco.exec files for Integration tests, When i provide them as comma separated to sonar.jacoco.itReportPaths the coverage in sonarQube is not showing but if i provide single jacoco file i can see the coverage report in SQ. Can you please show me how we suppose to provide multiple report files.
 
Using  org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6-rc1 in gradle file.

Regards,
Santhosh 

santho...@gmail.com

unread,
Dec 20, 2017, 1:17:28 AM12/20/17
to SonarQube
Hi Nicolas Peru,

This is the way i provided multiple report files sonar.jacoco.itReportPath=coverage/jacoco.exec,codeCoverage-instance-1/jacoco.exec,codeCoverage-instance-2/jacoco.exec  anything wrong in this ?

Thanks,
Santhosh

Nicolas Peru

unread,
Feb 2, 2018, 5:15:55 AM2/2/18
to santho...@gmail.com, SonarQube
Hi, 
as specified in the documentation (https://docs.sonarqube.org/display/PLUG/Code+Coverage+by+Unit+Tests+for+Java+Project) , and since quite some time now : the official property to use to pass your jacoco report to the analyzer is : sonar.jacoco.reportPaths 
All the other properties are now deprecated (so for any SQ >= 6.7 (latest LTS)). Moreover the one you mention was designed to only get one report, not a list.

Cheers, 


For more options, visit https://groups.google.com/d/optout.
--
Nicolas Peru | SonarSource
Reply all
Reply to author
Forward
0 new messages