SonarCloud code coverage with Azure pipeline and jacoco includes report files into coverage

Template for a good new topic, formatted with Markdown:

  • ALM used (Azure DevOps)
  • CI system used (Azure DevOps)
  • Scanner command used when applicable (private details masked)
  • Languages of the repository - Java
  • Error observed (wrap logs/code around with triple quotes ``` for proper formatting)

I’m trying to publish my java(Maven) code coverage report into SonarCloud via Azure Pipeline. The problem is that for some reason in SonarCloud UI I see that not only my code is checked, but in the end also jacoco report is treated as code (in folder /home/vsts/work/1/s/CCReport43F6D5EF), which then analyzed by sonar and it yields that I have bugs in that report.

My configuration is location in pom file in maven

    <sonar.projectKey>key</sonar.projectKey>
    <sonar.organization>org</sonar.organization>
    <sonar.host.url>https://sonarcloud.io</sonar.host.url>
    <sonar.sources>src/main/java/**</sonar.sources>
    <sonar.exclusions>
        **/someExclusions/**
    </sonar.exclusions>

How to make sonar to check only my source code and not check report? For me it is strange that report is there at all.

Task on pipeline

 - task: Maven@3
    inputs:
      jdkVersionOption: 1.11
      mavenPomFile: '$(Build.SourcesDirectory)/pom.xml'
      options: '-s $(Build.SourcesDirectory)/settings.xml'
      goals: 'verify sonar:sonar'
      codeCoverageTool: jaCoCo

  - task: SonarCloudPublish@1
    inputs:
      pollingTimeoutSec: '300'

Hello @Bohdan_Myslyvchuk,

Welcome to the community!

Did you set sonar.coverage.jacoco.xmlReportPaths ? Do you intent to import the coverage into SonarCloud?

Best,
Marcin