search
Get Started
search
Jenkins JaCoCo Plugin - Jenkins CI CD
zoom_in Click to enlarge

Jenkins JaCoCo Plugin

language

description Jenkins JaCoCo Plugin Overview

The Jenkins JaCoCo plugin integrates with JUnit tests to automatically generate code coverage reports directly within the Jenkins build process, tracking line and branch coverage metrics for Java projects.

help Jenkins JaCoCo Plugin FAQ

How do I generate a JaCoCo code coverage report in Jenkins?

To generate a report, you first need to ensure your Maven or Gradle build file is configured to output the JaCoCo .exec execution data file. Then, add the "Record JaCoCo coverage report" post-build action (or pipeline step `jacoco`) in your Jenkins job configuration. Point the plugin to the location of the .exec file and your class/source directories to render the report.

What is the difference between line coverage and branch coverage in the Jenkins JaCoCo Plugin?

Line coverage measures the percentage of executable lines of code that have been exercised by your JUnit tests. Branch coverage, on the other hand, calculates the percentage of execution branches (like if/else conditions) that have been evaluated. The JaCoCo plugin tracks both metrics, allowing you to set quality gates that fail the build if coverage drops below a certain threshold.

Why is my Jenkins JaCoCo Plugin showing zero coverage for my Java project?

This usually happens when the plugin cannot locate the .exec data file generated by your test execution or cannot match the compiled class files. You must ensure the path specified in the "Path to exec files" field accurately reflects where your build tool places the JaCoCo output. Additionally, verify that the tests are actually running before Jenkins attempts to record the coverage.

Can the Jenkins JaCoCo Plugin fail a build if code coverage decreases?

Yes, the plugin allows you to configure quality gates that will intentionally fail or mark the build as unstable based on coverage metrics. You can set specific thresholds for overall line coverage, branch coverage, or even the amount of new code introduced. This ensures developers cannot merge changes that lower the overall code health of the Java project.

Reviews & Comments

Write a Review

rate_review

Be the first to review

Share your thoughts with the community and help others make better decisions.

Save to your list

Save your favorites and follow how their scores change over time.

Save favorites
Track changes
Compare scores

Already have an account? Sign in

Compare Items

See how they stack up against each other

Comparing
VS
Select 1 more item to compare