SonarQube Code Coverage always shows 0%

Hello Team,
We have integrated Azure Devops with SonarQube which are Java Applications building from Azure pipelines. We are using Jfrog Maven task to build shared libraries, publising artifacts to Jfrog Artifactory & scanning code from SonarQube by using “Prepare analysis on SonarQube, Run code Analysis, publish Quality Gate Results”. Everything working fine. But only issue is code coverage is 0% for all the applications. So i have tried to install Jacoco plugin from POM.XML, it got istalled successfully by using below code. But still it is showing 0% coverage. Am i missing any Configurations ? Can any one help on this ?
Code :

    <build>
        <plugins>
            <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>0.8.10</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                    </execution>
                    <!-- attached to Maven test phase -->
                    <execution>
                        <id>report</id>
                        <phase>test</phase>
                        <goals>
                            <goal>report</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>    

SonarQube Version : Enterprize Edition: 9.9
Thanks in Advance,

Best Regards
Revathi

Hey there.

I think this guide should help you, including the section on Troubleshooting:

Hi Colin,
Thanks for the support,
I have tried that above method also but still it’s not generating coverage reports. I can see below messages from logs.
INFO org.jacoco.maven.ReportMojo - Skipping JaCoCo execution due to missing execution data file.
INFO: ‘sonar.coverage.jacoco.xmlReportPaths’ is not defined. Using default locations: target/site/jacoco/jacoco.xml,target/site/jacoco-it/jacoco.xml,build/reports/jacoco/test/jacocoTestReport.xml

I have one more question also we are using Parent child architecture that means do we need to use multi-module builds ? is it causing the issue ?

Thanks in Advance,

Best Regards
Revathi

Hey there.

SonarQube is just responsible for reading reports – not generating them (although we provide some guides that help most users get started).

I would suggest taking SonarQube out of the equation and just making sure you can successfully get a coverage report generated. You can check out JaCoCo’s page on support.