smithery/neversight

java-coverage

JaCoCo code coverage configuration for Java/Gradle projects. Covers report generation, coverage thresholds, multi-module aggregation, and SonarQube integration. Use when setting up or troubleshooting code coverage.

Installation

$ npx skills add smithery/neversight --skill java-coverage

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery/neversight · top by installs.

npx skills add smithery/neversight

Browse all from smithery/neversight

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Skill metadata

Parsed from SKILL.md frontmatter.

Version1.0.0
CompatibilityJava projects using Gradle with JaCoCo plugin
Declared agents cursor
More metadata
version
1.0.0
technology
java
category
quality
tags
["java","jacoco","coverage","testing"]

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 5,341 B
  • docs SUMMARY.md 235 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

Java Coverage

JaCoCo code coverage configuration for Java/Gradle projects.

When to use this skill

  • Setting up code coverage reporting
  • Configuring coverage thresholds
  • Aggregating coverage across modules
  • Integrating with SonarQube
  • Troubleshooting coverage reports

Skill Contents

Sections

  • [When to use this skill](#when-to-use-this-skill) (L23-L30)
  • [Quick Start](#quick-start) (L56-L93)
  • [Coverage Thresholds](#coverage-thresholds) (L94-L118)
  • [Exclusions](#exclusions) (L119-L138)
  • [Multi-Module Aggregation](#multi-module-aggregation) (L139-L189)
  • [SonarQube Integration](#sonarqube-integration) (L190-L200)
  • [References](#references) (L201-L207)
  • [Related Rules](#related-rules) (L208-L211)
  • [Related Skills](#related-skills) (L212-L218)

Available Resources

📚 references/ - Detailed documentation

  • [coverage targets](references/coverage-targets.md)
  • [exclusion patterns](references/exclusion-patterns.md)
  • [improvement workflow](references/improvement-workflow.md)
  • [multi module](references/multi-module.md)
  • [prioritization](references/prioritization.md)

Quick Start

1. Apply JaCoCo Plugin

plugins {
    id 'jacoco'
}

jacoco {
    toolVersion = "0.8.14"
}

2. Configure Report Task

jacocoTestReport {
    dependsOn test

    reports {
        xml.required = true  // For SonarQube
        html.required = true // For local viewing
    }
}

test {
    finalizedBy jacocoTestReport
}

3. Run Coverage

./gradlew test jacocoTestReport
# Report at: build/reports/jacoco/test/html/index.html

Coverage Thresholds

jacocoTestCoverageVerification {
    violationRules {
        rule {
            limit {
                minimum = 0.80  // 80% minimum coverage
            }
        }

        rule {
            element = 'CLASS'
            excludes = ['*.generated.*', '*.config.*']
            limit {
                counter = 'LINE'
                minimum = 0.70
            }
        }
    }
}

check.dependsOn jacocoTestCoverageVerification

Exclusions

Common patterns to exclude from coverage:

jacocoTestReport {
    afterEvaluate {
        classDirectories.setFrom(files(classDirectories.files.collect {
            fileTree(dir: it, exclude: [
                '**/generated/**',
                '**/config/**',
                '**/*Config.class',
                '**/*Properties.class',
                '**/Application.class'
            ])
        }))
    }
}

Multi-Module Aggregation

For aggregated reports across modules, use the modern jacoco-report-aggregation plugin (Gradle 7.4+):

// In root build.gradle
plugins {
    id 'base'
    id 'jacoco-report-aggregation'
}

// Ensure subprojects are evaluated first
subprojects.each { evaluationDependsOn(it.path) }

dependencies {
    subprojects.each { jacocoAggregation it }
}

reporting {
    reports {
        testCodeCoverageReport(JacocoCoverageReport) {
            testType = TestSuiteType.UNIT_TEST
        }
    }
}

For older Gradle versions, use a manual task with defensive filtering:

// In root build.gradle (Gradle < 7.4)
task jacocoRootReport(type: JacocoReport) {
    dependsOn subprojects*.test

    // Use defensive filtering to avoid missing-directory errors
    def srcDirs = files(subprojects*.sourceSets*.main*.allSource*.srcDirs).filter { it.exists() }
    def classDirs = files(subprojects*.sourceSets*.main*.output).filter { it.exists() }
    def execData = files(subprojects*.jacocoTestReport*.executionData).filter { it.exists() }

    additionalSourceDirs.from(srcDirs)
    sourceDirectories.from(srcDirs)
    classDirectories.from(classDirs)
    executionData.from(execData)

    reports {
        xml.required = true
        html.required = true
    }
}

SonarQube Integration

sonar {
    properties {
        property 'sonar.coverage.jacoco.xmlReportPaths',
            "${projectDir}/build/reports/jacoco/test/jacocoTestReport.xml"
    }
}

References

Reference Description
[references/exclusion-patterns.md](references/exclusion-patterns.md) Common exclusion patterns
[references/multi-module.md](references/multi-module.md) Multi-module aggregation

Related Rules

  • .cursor/rules/java-jacoco-coverage.mdc - Full JaCoCo reference

Related Skills

Skill Purpose
[java-testing](../java-testing/SKILL.md) Test configuration
[sonarqube-integration](../sonarqube-integration/SKILL.md) SonarQube setup
[gradle-standards](../gradle-standards/SKILL.md) Gradle configuration

<!-- AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY --> <!-- Source: bitsoex/ai-code-instructions → java/skills/java-coverage/SKILL.md --> <!-- To modify, edit the source file and run the distribution workflow -->