# 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
- Author: mariepellegrino89
- Repository: claude-dev-suite/claude-dev-suite
- Version: 20260206202537
- Stars: 0
- Forks: 0
- Last Updated: 2026-02-06
- Source: https://github.com/claude-dev-suite/claude-dev-suite
- Web: https://mule.run/skillshub/@@claude-dev-suite/claude-dev-suite~jacoco:20260206202537
---
---
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
## Quando Usare Questa Skill
- Configurare code coverage in progetti Java/Maven
- Impostare threshold di copertura
- Integrare 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.
## Pattern Essenziali
### Maven Configuration
```xml
org.jacoco
jacoco-maven-plugin
0.8.12
prepare-agent
prepare-agent
report
test
report
check
check
BUNDLE
LINE
COVEREDRATIO
0.80
```
### Exclusions
```xml
com.company.config.*
com.company.dto.*
com.company.entity.*
com.company.mapper.*Impl
```
### Comandi
```bash
mvn clean verify # Test + coverage check
mvn jacoco:report # Genera report
open target/site/jacoco/index.html # Visualizza
```
## Counter Types
| Counter | Descrizione |
|---------|-------------|
| `LINE` | Righe di codice |
| `BRANCH` | Branch if/switch |
| `METHOD` | Metodi |
## 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 `` |
| Only checking LINE coverage | Misses untested branches | Check both LINE and BRANCH |
| No coverage threshold in CI | Can't enforce quality | Add `` 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 `` |
| 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` |
## Approfondimenti
> Per configurazioni avanzate: `mcp__documentation__fetch_docs`
> - Technology: `jacoco` (not yet in MCP - use official docs)
> - [JaCoCo Docs](https://www.jacoco.org/jacoco/trunk/doc/)