Executed + Java Collector
Enforce Executed using data collected by Java Collector. Automatically check testing and quality standards on every PR.
How Java Collector Powers This Guardrail
The Java Collector gathers metadata from your languages, build systems. This data flows into Lunar's Component JSON, where the Executed guardrail evaluates it against your standards.
When enabled, this check runs automatically on every PR and in AI coding workflows, providing real-time enforcement with actionable feedback.
Quick Start Configuration
Add both the collector and policy to your lunar-config.yml to enable this guardrail.
# Step 1: Enable the Java Collector
collectors:
- uses: github://earthly/lunar-lib/collectors/java@v1.0.5
# with: ...
# Step 2: Enable the Testing Guardrails
policies:
- uses: github://earthly/lunar-lib/policies/testing@v1.0.5
include: [executed]
# with: ...
What Java Collector Collects
This collector gathers the following data that the Executed guardrail evaluates.
project
Detects Java project structure including build tools (Maven/Gradle), Java version from build config, wrapper scripts, and static analysis tool configuration. Writes project metadata to .lang.java.
dependencies
Extracts direct dependencies from pom.xml (using Python XML parsing with property resolution) or gradle.lockfile. Writes dependency data to .lang.java.dependencies.
cicd
Records java/javac commands executed in CI pipelines along with the Java version. Writes command strings and version info to .lang.java.cicd.cmds.
maven-cicd
Records Maven commands executed in CI pipelines along with the Maven version. Detects version from installation path, wrapper properties, or mvn --version. Writes to .lang.java.maven.cicd.cmds.
Example Data Flow
Here's an example of the data that Java Collector writes to the Component JSON, which Executed then evaluates.
{
"lang": {
"java": {
"version": "17",
"build_systems": ["maven"],
"pom_xml_exists": true,
"build_gradle_exists": false,
"mvnw_exists": true,
"gradlew_exists": false,
"gradle_lockfile_exists": false,
"checkstyle_configured": true,
"spotbugs_configured": false,
"source": { "tool": "java", "integration": "code" },
"cicd": {
"cmds": [
{ "cmd": "java -jar app.jar", "version": "17.0.2" }
]
},
"maven": {
"cicd": {
"cmds": [
{ "cmd": "mvn clean install", "version": "3.9.6" }
]
}
},
"sbt": {
"cicd": {
"cmds": [
{ "cmd": "sbt test", "version": "1.9.7" }
]
}
},
"tests": {
"scope": "all",
"results": {
"total": 156,
"passed": 152,
"failed": 1,
"skipped": 3,
"source": { "tool": "maven", "integration": "ci" }
},
"coverage": {
"percentage": 72.5,
"source": { "tool": "jacoco", "integration": "ci" }
}
},
"dependencies": {
"direct": [
{ "path": "org.springframework:spring-core", "version": "6.1.3", "indirect": false }
],
"transitive": [],
"source": { "tool": "maven", "integration": "code" }
}
}
},
"testing": {
"source": { "tool": "maven-surefire", "integration": "ci" },
"results": { "total": 156, "passed": 152, "failed": 1, "skipped": 3 },
"all_passing": false,
"runs": [
{
"pipeline": "CI",
"run_id": "36909154652",
"attempt": 1,
"job": "build",
"step": 4,
"total": 156,
"passed": 152,
"failed": 1,
"skipped": 3,
"all_passing": false
}
],
"coverage": {
"percentage": 72.5,
"source": { "tool": "jacoco", "integration": "ci" }
}
}
}
Configuration Options
Testing Guardrails Inputs
| Input | Required | Default | Description |
|---|---|---|---|
required_languages |
Required | — | Comma-separated list of languages to check (e.g., "go,python,nodejs,java"). If empty, applies to all components with any detected language project. Components without .lang.* are always skipped (e.g., docs-only repos). |
min_coverage |
Optional |
80
|
Minimum required coverage percentage (for min-coverage check) |
Ready to Automate Your Standards?
See how Lunar can turn your AGENTS.md, engineering wiki, compliance docs, or postmortem action items into automated guardrails with our 300+ built-in guardrails.