Jacoco.xml report is imported but not showing in SQ gui (0% code coverage)

Must-share information (formatted with Markdown):

  • which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)
    SonarQube server
    jacoco 0.8.10

  • what are you trying to achieve
    i run ‘maven clean verify’ and report task.
    i want to see the code coverage in sonarqube results, produce the xml and see the output in the SQ gui

  • what have you tried so far to achieve this
    i have set the property :
    and during the sonarqube scanner phase this is seen in the log:
    INFO: Sensor JaCoCo XML Report Importer [jacoco]
    INFO: Importing 1 report(s). Turn your logs in debug mode in order to see the exhaustive list.
    INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=47ms

Also when i go into the project in sonarqube i can see that the jacoco.xml file is found in the correct path (and there are correct values in there) but , still the code coverage is 0%
How can i make it so that the code coverage is shown in the GUI?


Welcome to the community!

Could you provide your analysis log?

The analysis / scanner log is what’s output from the analysis command. Hopefully, the log you provide - redacted as necessary - will include that command as well.

This guide will help you find them.


hi ann,
i see that you would have to run mvn sonar:sonar -X
But i dont use that way, i use in my module’s pom.xml:


And i run Sonarqube through Azure DevOps with the following yaml:

  - task: Maven@3
              displayName: 'Run Maven Test'
                mavenPomFile: 'pom.xml'
                goals: 'clean verify'
                options: '-P$(APPNAME)'
                publishJUnitResults: false
                javaHomeOption: 'Path'
                jdkDirectory: 'F:\Tools\Java\openjdk-17.0.7'
                mavenVersionOption: 'Default'
                mavenAuthenticateFeed: false
                effectivePomSkip: false
                sonarQubeRunAnalysis: false
            - task: SonarQubePrepare@5
              displayName: 'Prepare SonarQube Analysis'
                SonarQube: 'Sonar-P'
                scannerMode: 'CLI'
                configMode: 'manual'
                cliprojectKey: $(APPNAME)-API
                cliprojectName: '$(APPNAME)-API'
                cliSources: '.'
                extraProperties: |
            - task: SonarQubeAnalyze@5
              displayName: 'Run SonarQube Code Analysis'
                JAVA_HOME: 'F:\Tools\Java\openjdk-17.0.7'


Ordinary analysis logs should be generated automatically, without the need for -X on the Maven command line. Although if you did want debug-level logging, you could easily add to your extraProperties:




Post it here, redacted as necessary.



From what I can see - and as you said from the start - your report is imported without errors:

2023-06-19T13:01:30.7573636Z 15:01:30.754 INFO: Sensor JaCoCo XML Report Importer [jacoco]
2023-06-19T13:01:30.7807228Z 15:01:30.770 INFO: Importing 1 report(s). Turn your logs in debug mode in order to see the exhaustive list.
2023-06-19T13:01:30.7807627Z 15:01:30.770 DEBUG: Reading report 'F:\Agents\4\ws\118\s\jaf-guilogs\target\site\jacoco-aggregate\jacoco.xml'
2023-06-19T13:01:30.8172745Z 15:01:30.801 INFO: Sensor JaCoCo XML Report Importer [jacoco] (done) | time=47ms

Typically in a case where the report is read by the coverage that shows up in SonarQube is below expectations, there are errors reported during the coverage report import. That’s not the case here, so you should take a look at what’s in your report:

  • does it include all the files you think it should?
  • does it show the coverage you expect for those files?


Hi, there is correct data in the .xml file as far as i can see.
but it seems it just isnt showed in the gui for the project… as it should have more than 0% coverage… im guessing there should be some other configuration in sonarqube to see that? should i change something in the general settings?


Going back to your log…

We’re dealing with a JaCoCo report? So it covers Java files?

Because I’m seeing this in your log:

2023-06-19T13:01:25.4664921Z 15:01:25.462 INFO: Indexing files...
2023-06-19T13:01:25.4665364Z 15:01:25.462 INFO: Project configuration:
2023-06-19T13:01:25.4673535Z 15:01:25.462 INFO:   Excluded sources: src/test/**/*, **/*.java

Exactly how many files, and of what language(s) show up in SonarQube for you?


I see actually that sonarqube says/thinks its XML and not java…
1.2K lines XML so that might be the issue? how to make it see that it is java code instead of xml ?


If you look at those files, are the contents Java or XML?

Also, take a look at your exclusion settings, and edit them so you’re not excluding **/*.java.


Yes i understand now, i excluded the java files, now its working without that.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.