How to fix build error related to Jacoco Test Coverage

Code coverage is a software metric used to measure how many lines of code is executed during automated tests.

Jacoco is a code coverage report generator for Java Projects. You need to add the maven plugin for jacoco and get the code coverage reports.

Jacoco Plugin dependency in pom.xml:-





You can also configure the code coverage ratio in the plugin by using the rules tag like this:-

You can either write the covered ratio as 10% or 0.10 .

Sometimes we get a build error like following 

To fix this issue simply add more test cases in the module which is showing the build failure.

For instance in the above stack trace the module (gcmms-api-client) is showing coverage ratio is 0.09, but expected minimum is 0.10 so simply add more test cases in this module and build the project again.The issue will be resolved.

Published by Anna

Just a simple girl who loves to code. .I am primarily a Java developer by profession and I am here to share my love for coding with you all I hope you enjoy reading my blog. Happy Coding Guys :-)

Leave a comment

Your email address will not be published. Required fields are marked *