Error flagged in CI (Jenkins) during sonarqube analysis

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube 9.9.0-Enterprise)
  • how is SonarQube deployed: Docker
  • what are you trying to achieve
    Basic analysis of java project with gradle-plugin
  • what have you tried so far to achieve this
    Set location of jacoco coverage report, using sonar.coverage.jacoco.xmlReportPaths='build/reports/jacoco/test/jacocoTestReport.xml set on command-line.
    Analysis log attached showing error message and portion of XML file. It appears the XML contains no line breaks, suggesting the “smoking gun.”

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!
missing_coverage_report.txt (1.5 KB)

Hi,

XML doesn’t (necessarily) need linebreaks. If there’re in there, they’re for the reading comfort of us humans.

The error

No coverage report can be found with sonar.coverage.jacoco.xmlReportPaths='build/reports/jacoco/test/jacocoTestReport.xml'.

Is telling you that analysis didn’t find your report at the location you specified. This is more than likely a question of pathing. Does the path start from the directory where analysis is kicked off? In other words, from where analysis starts, can you cd directly into build/reports/...?

 
Ann

Yes, attached log shows I was in the directory being analyzed, and file was present

Hi,

It’s not clear to me that the log does show that.

Again, is the build directory located in the directory from which analysis is run?

 
Ann

Typical Java project layout:
Jenkinsfile
build.gradle
src/
build/

Analysis run in top-level dir.

Hi,

So the path should have been valid, relative to where analysis was executed from. And it seems that the path you set by parameter

Is the same as the default:

Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml

So analysis looked twice and didn’t find it.

Can you verify that the file exists at that location, with that exact spelling and capitalization?

 
Ann

Hi,

From the log file I uploaded:
build/reports/jacoco/test/jacocoTestReport.xml
(The workspace was no longer there, so I could not provide an actual file directory listing.)

Hi,

Well, then I’m out of ideas.

 
Ann