Skip to content
Skills Library
Programming · Testing

jacoco

/jacoco

JaCoCo Java code coverage tool USE WHEN: user mentions "JaCoCo", "Java coverage", "code coverage", asks about "coverage threshold", "jacoco-maven-plugin", "coverage report", "LINE coverage", "BRANCH coverage" DO NOT USE FOR: JavaScript/TypeScript coverage - use Vitest skill, SonarQube analysis - use `sonarqube` skill, test execution - use testing skills

Licence
MIT
Last repository change
21.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
1
Deprecation

No signals detected. Repository changed on 21.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

JaCoCo Java code coverage tool USE WHEN: user mentions "JaCoCo", "Java coverage", "code coverage", asks about "coverage threshold", "jacoco-maven-plugin", "coverage report", "LINE coverage", "BRANCH coverage" DO NOT USE FOR: JavaScript/TypeScript coverage - use Vitest skill, SonarQube analysis - use `sonarqube` skill, test execution - use testing skills

Triggers from the description

JaCoCoJava coveragecode coveragecoverage thresholdjacoco-maven-plugincoverage reportLINE coverageBRANCH coverage
Original author description

JaCoCo Java code coverage tool USE WHEN: user mentions "JaCoCo", "Java coverage", "code coverage", asks about "coverage threshold", "jacoco-maven-plugin", "coverage report", "LINE coverage", "BRANCH coverage" DO NOT USE FOR: JavaScript/TypeScript coverage - use Vitest skill, SonarQube analysis - use `sonarqube` skill, test execution - use testing skills

How it works

  1. When to Use This Skill
  2. When NOT to Use This Skill
  3. Essential Patterns
  4. Counter Types
  5. Anti-Patterns
  6. Quick Troubleshooting
  7. Further Reading
Original SKILL.md headings · 106 lines, 438 words
SKILL.md preview
---
name: jacoco
description: |
  JaCoCo Java code coverage tool

  USE WHEN: user mentions "JaCoCo", "Java coverage", "code coverage", asks about "coverage threshold", "jacoco-maven-plugin", "coverage report", "LINE coverage", "BRANCH coverage"

  DO NOT USE FOR: JavaScript/TypeScript coverage - use Vitest skill, SonarQube analysis - use `sonarqube` skill, test execution - use testing skills
allowed-tools: Read, Grep, Glob
---
# JaCoCo - Quick Reference

## When to Use This Skill
- Configure code coverage in Java/Maven projects
- Set coverage thresholds
- Integrate coverage in CI/CD

## When NOT to Use This Skill
- **JavaScript/TypeScript coverage** - Use Vitest skill for frontend coverage
- **SonarQube configuration** - Use `sonarqube` skill for quality gates
- **Test writing** - Use Spring Boot Test or JUnit skills
- **Gradle projects** - JaCoCo works but syntax differs from Maven

> **Deep Knowledge**: Use `mcp__documentation__fetch_docs` with technology: `jacoco` for comprehensive documentation.

## Essential Patterns

### Maven Configuration
```xml
<plugin>
    <groupId>org.jacoco</groupId>
    <artifactId>jacoco-maven-plugin</artifactId>
    <version>0.8.12</version>
    <executions>
        <execution>
            <id>prepare-agent</id>
            <goals><goal>prepare-agent</goal></goals>
        </execution>
        <execution>
            <id>report</id>
            <phase>test</phase>
            <goals><goal>report</goal></goals>
        </execution>
        <execution>
            <id>check</id>
            <goals><goal>check</goal></goals>
            <configuration>
                <rules>
                    <rule>
                        <element>BUNDLE</element>
                        <limits>
                            <limit>
                                <counter>LINE</counter>
                                <value>COVEREDRATIO</value>
                                <minimum>0.80</minimum>
                            </limit>
                        </limits>
                    </rule>
                </rules>
            </configuration>
        </execution>
    </executions>
</plugin>
```

### Exclusions
```xml
<excludes>
    <exclude>com.company.config.*</exclude>
    <exclude>com.company.dto.*</exclude>
    <exclude>com.company.entity.*</exclude>
    <exclude>com.company.mapper.*Impl</exclude>
</excludes>
```

### Commands
```bash
mvn clean verify           # Test + coverage check
mvn jacoco:report          # Generate report
open target/site/jacoco/index.html  # View report
```

## Counter Types
| Counter | Description |
|---------|-------------|
| `LINE` | Lines of code |
| `BRANCH` | Branch if/switch |
| `METHOD` | Methods |

## Anti-Patterns

| Anti-Pattern | Why It's Bad | Correct Approach |
|--------------|--------------|------------------|
| Aiming for 100% coverage | Diminishing returns, test bloat | Target 80% LINE, 70% BRANCH |
| Including DTOs/entities in coverage | Inflates numbers, no logic to test | Exclude with `<excludes>` |
| Only checking LINE coverage | Misses untested branches | Check both LINE and BRANCH |
| No coverage threshold in CI | Can't enforce quality | Add `<check>` goal with minimums |
| Excluding too much code | False sense of security | Only exclude generated/config code |
| Not versioning jacoco.exec | Can't track coverage trends | Archive reports in CI |

## Quick Troubleshooting

| Issue | Likely Cause | Solution |
|-------|--------------|----------|
| Coverage report shows 0% | Tests not running with agent | Ensure `prepare-agent` goal runs before tests |
| Build fails on coverage check | Coverage below threshold | Add tests or adjust minimum in `<limit>` |
| Report excludes nothing | Wrong exclude pattern | Use fully qualified names (com.company.dto.*) |
| Report missing classes | Classes not loaded during tests | Add integration tests to cover them |
| Coverage lower in CI than local | Different test execution | Ensure CI runs all test phases |
| SonarQube shows no coverage | Wrong report path | Check `sonar.coverage.jacoco.xmlReportPaths` |

## Further Reading
> For advanced configurations: `mcp__documentation__fetch_docs`
> - Technology: `jacoco` (not yet in MCP - use official docs)
> - [JaCoCo Docs](https://www.jacoco.org/jacoco/trunk/doc/)

Versions

The database has no other skills named jacoco.

Database snapshot: 13.11.2026 · package version af6e72d52dd4 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100jacoco-analysis
    Configures JaCoCo for JVM projects (Java / Kotlin / Scala / Groovy) - wires the runtime agent via `jacoco-maven-plugin` `prepare-agent`, generates per-build reports (HTML / XML / CSV) via the `report` goal, gates the build via the `check` goal with element / limit / minimum…
  • 100code-coverage
    When the user wants to measure, interpret, or improve code coverage — line, branch, function, statement, condition, MC/DC coverage. Use when the user mentions "code coverage," "test coverage," "Istanbul," "c8," "JaCoCo," "coverage.py," "Coverlet," "lcov," "Codecov," "Coveralls,"…
  • 100code-coverage-metrics-analysis-sonarqube
    Use this skill when tracking line coverage, branch coverage, security hotspots, and quality gates in CI pipelines via SonarQube.
  • 82xwiki-increase-test-coverage
    Increase (and lock in) the unit-test coverage of an XWiki module. Run this automatically whenever unit tests are added or changed in a module — as part of that same change — as well as when explicitly asked to raise coverage. It recomputes the module's achieved JaCoCo…
  • 100lcov-analysis
    Parses both mainstream coverage interchange formats: LCOV `.info` text files (produced by gcov, llvm-cov, Coverage.py via `py2lcov`, JaCoCo via `xml2lcov`, Devel::Cover, Jest via `lcov` reporter, NYC, and most others) and Cobertura XML (coverage-04.dtd - emitted by JaCoCo,…
  • 100build-and-test
    Mapping a multi-module Gradle project before guessing a task name, building a variant, running JVM vs on-device tests, and turning a JaCoCo coverage report into the specific lines that need a test. Use when building, testing, or checking coverage for an Android/Gradle project.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.