Java
What is planned
Section titled “What is planned”When the built-in Java runner ships, it will:
- Accept
lang: javainnolapse.yaml. - Support both Maven (
mvn test) and Gradle (./gradlew test) build systems automatically. - Parse JaCoCo XML or CSV reports to extract overall instruction or line coverage.
- Respect the same
warn_threshold/fail_threshold/strict_modesettings as all other runners.
The expected nolapse.yaml when it is available:
lang: javawarn_threshold: -1.0fail_threshold: -5.0strict_mode: falseWorkaround: custom runner (Maven + JaCoCo)
Section titled “Workaround: custom runner (Maven + JaCoCo)”Until the built-in runner ships you can parse JaCoCo output yourself and emit the result in the format nolapse expects.
1. Add the JaCoCo plugin
Section titled “1. Add the JaCoCo plugin”In your pom.xml:
<plugin> <groupId>org.jacoco</groupId> <artifactId>jacoco-maven-plugin</artifactId> <version>0.8.11</version> <executions> <execution> <goals><goal>prepare-agent</goal></goals> </execution> <execution> <id>report</id> <phase>test</phase> <goals><goal>report</goal></goals> </execution> </executions></plugin>2. Write a custom runner script
Section titled “2. Write a custom runner script”Create nolapse-runner.sh at the repo root:
#!/usr/bin/env bashset -euo pipefail
REPO_PATH="${1:-.}"cd "$REPO_PATH"
mvn -q test
# Parse JaCoCo CSV: covered / (covered + missed) for INSTRUCTIONCSV="target/site/jacoco/jacoco.csv"PCT=$(tail -n +2 "$CSV" | awk -F',' ' { covered += $5; missed += $4 } END { printf "%.1f", (covered / (covered + missed)) * 100 }')
echo "nolapse-coverage: ${PCT}"Make it executable:
chmod +x nolapse-runner.sh3. Configure nolapse
Section titled “3. Configure nolapse”lang: customwarn_threshold: -1.0fail_threshold: -5.0Run nolapse:
NOLAPSE_RUNNER_PATH=./nolapse-runner.sh nolapse run --repo .See Custom Runner for the full runner contract.
Workaround: Gradle + JaCoCo
Section titled “Workaround: Gradle + JaCoCo”For Gradle projects, replace the Maven step in the runner script with:
./gradlew test jacocoTestReportCSV="build/reports/jacoco/test/jacocoTestReport.csv"The CSV parsing awk expression is the same.
Track the roadmap
Section titled “Track the roadmap”Watch the nolapse changelog and the Java runner issue for updates.