Difference in %age coverages


I am generating HTML report out of jacooc.exec and side by side publishing jacoco.exec to sonarQube as well but the %age coverage is different in HTML report v/s what jacoco.exec is publishing on sonar.

Can anyone help me here to get the exact reason of difference between these %age coverages?

Without providing more details it would be impossible to guess what could be the reason for difference. Can you localize the code where the difference occurs?

Otherwise, if you want the coverage reports to match exactly I would recommend to use XML report format (binary exec format is deprecated already). With XML report you will have exact number as in the report. Check this guide for more information [Coverage & Test Data] Importing JaCoCo coverage report in XML format