# Sonarqube not picking up jacoco.xml file

**URL:** <https://community.sonarsource.com/t/sonarqube-not-picking-up-jacoco-xml-file/115996>\
**Category:** SonarQube Server / Community Build\
**Tags:** sonarqube, java, coverage\
**Created:** [May 26, 2024, 9:31am UTC](https://community.sonarsource.com/t/sonarqube-not-picking-up-jacoco-xml-file/115996 "2024-05-26T09:31:29Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dhruv\_Mathur1](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/dhruv_mathur1/32/49047_2.png) [@Dhruv\_Mathur1](https://community.sonarsource.com/u/Dhruv_Mathur1)\
**Post date:** [May 26, 2024, 9:31am UTC](https://community.sonarsource.com/t/sonarqube-not-picking-up-jacoco-xml-file/115996/1 "2024-05-26T09:31:29Z")

</div>

Must-share information (formatted with [Markdown](https://commonmark.org/help/)):

- which versions are you using (SonarQube, Scanner, Plugin, and any relevant extension)

Sonarqube version : 10.5.0.89998

Using: Installed and ran sonarqube through brew.

Trying to analyze code coverage for my project  
Tried configuring jacoco plugin and properties through pom.xml file.

properties defined as

```auto
 <properties>
        <java.version>1.8</java.version>
        <jacoco.version>0.8.6</jacoco.version>
        <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
        <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
        <sonar.jacoco.reportPath>${project.basedir}/../target/jacoco.exec</sonar.jacoco.reportPath>
        <sonar.coverage.jacoco.xmlReportPaths>/Users/dhruv/Downloads/Projects/finance-consumer/target/site/jacoco/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
        <sonar.language>java</sonar.language>
        <sonar.qualitygate.wait>true</sonar.qualitygate.wait>
    </properties>

```

dependency for unit test (junit 5)

```auto
 <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>

```

jacoco depndency

```auto
<dependency>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.8.6</version>
        </dependency>

```

jacoco plugin

```auto
<plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <executions>
                    <execution>
                        <id>jacoco-initialize</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <execution>
                        <id>jacoco-site</id>
                        <phase>package</phase>
                        <goals>
                            <goal>report-aggregate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

```

I am able to generate proper jacoco exec file and visualize it using jacoco.html file

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [May 27, 2024, 6:11am UTC](https://community.sonarsource.com/t/sonarqube-not-picking-up-jacoco-xml-file/115996/2 "2024-05-27T06:11:50Z")

</div>

Hey there.

What do the logs say about importing the coverage reports?

> [@How to find logs about importing code coverage](https://community.sonarsource.com/t/how-to-find-logs-about-importing-code-coverage/73317):
>
> When coverage data isn’t appearing as expected in SonarQube Server / Community Build or SonarQube Cloud, the first place you should look is the scanner logs. Where do I find the scanner logs?warning This will likely be broken out into its own guide soon The Scanner logs are the output of executing one of the [scanners](https://docs.sonarqube.org/latest/analysis/overview/), either directly or wrapped by one of many integrations, such as the [SonarScanner for Jenkins](https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-jenkins/), [SonarScanner for Azure DevOps](https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-azure-devops/), [SonarQube](https://github.com/SonarSource/sonarqube-scan-action)/[SonarCloud](https://github.com/marketplace/actions/sonarcloud-scan) GitHub Actions or [SonarQube](https://bitbucket.org/sonarsource/sonarqube-scan/src/master/) /…

---

<div class="post-metadata">

**Author:** ![Dhruv\_Mathur1](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/dhruv_mathur1/32/49047_2.png) [@Dhruv\_Mathur1](https://community.sonarsource.com/u/Dhruv_Mathur1)\
**Post date:** [May 28, 2024, 11:14am UTC](https://community.sonarsource.com/t/sonarqube-not-picking-up-jacoco-xml-file/115996/3 "2024-05-28T11:14:56Z")

</div>

hi @Colin,

Please find the log lines below regarding the coverage report imports.

```auto
[INFO] 16:43:36.839 No "Generated" source files to scan.
[INFO] 16:43:36.839 Sensor JavaSensor [java] (done) | time=11906ms
[INFO] 16:43:36.839 Sensor JaCoCo XML Report Importer [jacoco]
[WARNING] 16:43:36.841 No coverage report can be found with sonar.coverage.jacoco.xmlReportPaths='/Users/dhruv/Downloads/Projects/finance-consumer/target/site/jacoco/jacoco.xml'. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml
[INFO] 16:43:36.841 No report imported, no coverage information will be imported by JaCoCo XML Report Importer

```

but I don’t see what exactly is causing this issue.

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [May 29, 2024, 12:47pm UTC](https://community.sonarsource.com/t/sonarqube-not-picking-up-jacoco-xml-file/115996/4 "2024-05-29T12:47:28Z")

</div>

> [@Dhruv\_Mathur1](#):
>
> `/Users/dhruv/Downloads/Projects/finance-consumer/target/site/jacoco/jacoco.xml`

Have you made sure this file exists?

You can try just a `cat /Users/dhruv/Downloads/Projects/finance-consumer/target/site/jacoco/jacoco.xml` in the terminal.

---

<div class="post-metadata">

**Author:** ![Dhruv\_Mathur1](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/dhruv_mathur1/32/49047_2.png) [@Dhruv\_Mathur1](https://community.sonarsource.com/u/Dhruv_Mathur1)\
**Post date:** [May 31, 2024, 7:09am UTC](https://community.sonarsource.com/t/sonarqube-not-picking-up-jacoco-xml-file/115996/5 "2024-05-31T07:09:15Z")

</div>

Actually I got the issue. the problem was with wrong directory structure. Herby I am attaching the screenshot for reference. After I restructured my application I was able to get the code coverage. Since there were two structures due ambiguity the jacoco file that was generated was not getting imported properly.

 ![Screenshot 2024-05-31 at 12.30.18 PM](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/9/5/95af2dc17d95d7d0dd2cf01c0c0f0d0d3db38364.jpeg)

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/system/32/31083_2.png) [@system](https://community.sonarsource.com/u/system)\
**Post date:** [June 7, 2024, 7:09am UTC](https://community.sonarsource.com/t/sonarqube-not-picking-up-jacoco-xml-file/115996/6 "2024-06-07T07:09:38Z")

</div>

Closed on June 7, 2024, 7:09am UTC

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