How to configure jacoco codecoverage to a multi module maven project

Hi Team,
I’m facing issues in configuring jacoco code coverage for a multi module with 12 modules maven project
Using sonarqube LTs 7.9 version with jacoco xml 1.1.0 plugin in sonarqube and
pom.xml plugins
maven plugin 2.5.0
sonar maven plugin 3.7.0
jacoco maven plugin 0.8.6

org.jacoco
jacoco-maven-plugin
0.8.6

prepare-agent ${sonar.jacoco.reportPaths} surefireArgLine merge-results merge ${sonar.jacoco.reportPaths} ${project.build.directory}/jacoco *.exec test report ${sonar.jacoco.reportPaths} ${project.reporting.outputDirectory}/jacoco-ut report-aggregate verify coverage-check check PACKAGE LINE COVEREDRATIO 80% maven-surefire-plugin 2.22.1 ${surefireArgLine} UTF-8 http://ip:9000/
    <maven.compiler.source>1.6</maven.compiler.source>
    <maven.compiler.target>1.6</maven.compiler.target>
    <java.version>11</java.version>
    <jacoco.version>0.8.6</jacoco.version>
     <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
    <sonar.language>java</sonar.language>
   <sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.coverage.jacoco.xmlReportPaths>${project.build.directory}target/site/jacoco-ut/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
<sonar.jacoco.reportsPaths>${project.build.directory}/jacoco.exec</sonar.jacoco.reportsPaths>
    </properties>

pls suggest any changes as I’m getting 0 code coverage though I have configured unit tests

Thanks in advance

1 Like

Hello @Anuradha_Varganti ,

Welcome to the SonarSource Community. :wave: . I hope you’ll enjoy it

There’s plenty of tutorials on this forum about Jacoco coverage import for Maven multimodules projects. Did you check them ?
See:

and more…

Olivier