How to get sonar-jacoco-plugin

I have generate the jacoco xml report.But my sonarqube can’t resolve the xml report.

  • jacoco 0.8.3
  • sonar plugin 2.7.1
  • sonarqube 6.7
  • gradle 5.4.1

I have read the previous discussion.It didn’t load sonar-jaococ plugin.

15:45:22.279 [DEBUG] [org.sonarqube.gradle.SonarQubeTask] Plugins:
15:45:22.280 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * CSS / SCSS / Less 3.2-SNAPSHOT (css)
15:45:22.280 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * PMD 2.6 (pmd)
15:45:22.280 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * Android 1.2-SNAPSHOT (android)
15:45:22.280 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * Bitbucket Authentication for SonarQube 1.0 (authbitbucket)
15:45:22.280 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * Golang 1.2.2 (golang)
15:45:22.280 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * SonarQube :: Plugins :: SCM :: SVN (scmsvn)
15:45:22.280 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * GitLab Auth 1.2.2 (authgitlab)
15:45:22.280 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * SonarC# (csharp)
15:45:22.280 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * SonarJava (java)
15:45:22.280 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * Web (web)
15:45:22.280 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * Flex 2.3 (flex)
15:45:22.280 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * SonarXML (xml)
15:45:22.281 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * Rules Compliance Index (RCI) 1.0.3-SNAPSHOT (rci)
15:45:22.281 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * SonarTS (typescript)
15:45:22.281 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * Checkstyle 3.6.1 (checkstyle)
15:45:22.281 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * Issue resolver 1.0.2 (issueresolver)
15:45:22.281 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * C++ (Community) 0.9.7 (cxx)
15:45:22.281 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * SonarPython (python)
15:45:22.281 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * Code Smells 4.0.1-SNAPSHOT (smells)
15:45:22.281 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * GitHub Authentication for SonarQube 1.3 (authgithub)
15:45:22.281 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * jDepend 1.1.2-SNAPSHOT (jdepend)
15:45:22.281 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * SonarJS (javascript)
15:45:22.281 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * Findbugs 3.6.0 (findbugs)
15:45:22.281 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * SonarQube :: Plugins :: SCM :: Git (scmgit)
15:45:22.281 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * SoftVis3D Sonar plugin 1.0 (softvis3d)
15:45:22.281 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * SonarPHP (php)
15:45:22.281 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * Timeline 1.6-SNAPSHOT (timeline)
15:45:22.281 [DEBUG] [org.sonarqube.gradle.SonarQubeTask]   * GitLab 2.0.1 (gitlab)

But I can’t open this page.

And I can’t find any message about reading report in the debug information.

Can anyone help me solve this problem?

Hi @pengj666,

You’re on a pretty old, unsupported version of SonarQube (6.7). This version of SonarQube didn’t support the JaCoCo XML format, only the binary .exec format, which is read natively by the Java analyzer. If you want to use JaCoCo XML, you’ll need to move to at least SonarQube 7.9.



Hi, @Cameron
That’s too bad.I saw that the Jacoco report was correct and even thought it was close to success.

Is there a way to get unit test coverage across moudle in version 6.7.For example, a method is in Moudle1, but its test method is in Moudle2, for various reasons.

I’ve tried jacocoMerge before. However, only the coverage of the unit test in the same module as the class under test can be counted.I even felt a little hopeless.Can I only upgrade to the Sonarqube version?

Thank you very much for your reply.

Hi @pengj666,

If you’re using XML coverage, you can use JaCoCo aggregate reporting. You can find a great article by my colleague Tibor over in our Guides section. But you’ll still need the JaCoCo XML plugin, which means you’ll need to upgrade to SonarQube 7.9.



Hi @Cameron
This may solve some of my questions.I feel close to the truth.I will try again.

Thank you for the reply.

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