No coverage report can be found with sonar.coverage.jacoco.xmlReportPaths

Hey guys, I am trying to upload coverage from my kotlin project using kotlinx-kover. Some details:

ALM Used: Github
CI system used: Github Actions
Language: Kotlin/Java

My xml report path is set like this in the base $project_dir/build.gradle.kts file


with the filesystem looking like

build/ ## report file goes here under build/reports/

I have kotlinx-kover configured to use merged reports, as the application folder is configured as a sub project, and have set jacoco as the coverage agent. This outputs a single xml report in the $project_dir/build/reports/kover/merged/xml/report.xml

Heres the details from my GHA:

      - name: Build and analyze
        run: ./gradlew build koverMergedXmlReport -i

      - name: ls filesystem
        if: always()
        run: |
          echo ">> printing pwd"
          echo ">> cat file"
          cat build/reports/kover/merged/xml/report.xml

      - name: Run Sonar
        run: ./gradlew sonar --info

in the GHA logs, i can see the report.xml file being printed, so its there:

>> cat file
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><!DOCTYPE report PUBLIC "-//JACOCO//DTD Report 1.1//EN" "report.dtd"><report name=":"><sessioninfo id="small-standard-runner-eks-pool-pod"...etc

however during the sonar step, i am seeing this error:

No coverage report can be found with sonar.coverage.jacoco.xmlReportPaths='build/reports/kover/merged/xml/report.xml'. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
No report imported, no coverage information will be imported by JaCoCo XML Report Importer

The file is clearly there as proven by the prior step, why can’t it find this file? Does it think it is invalid?

I’m not familiar with this syntax for passing properties to the scanner – at least, it’s not what is documented

// build.gradle
sonarqube {
    properties {
        property "sonar.sourceEncoding", "UTF-8"

Have you tried passing the coverage property/value this way?

Thats because its a build.gradle.kts file, its written in kotlin, but its equivalent.

In the logs I can see it has picked up that property, so I know its working.

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

I’m able to reproduce this locally now…

To be honest, what I’m most concerned about is the single quotes wrapping the file name. That’s why I asked about the syntax for passing properties.

What happens if you pass the coverage report as an analysis parameter overriding the build.gradle.kts file? For example: gradle sonarqube -Dsonar.coverage.jacoco.xmlReportPaths=build/reports/kover/merged/xml/report.xml

That doesn’t seem to be the issue

Am I going to get this error message if the file is in an invalid format?

I am wondering if the kover-kotlin jacoco output has some metadata sonarcloud doesn’t like