apache/kafka · error · GradleException
No project JARs configured on…
Error message
No project JARs configured on kafkaPublicApiChecker.projectJarFiles — the checker needs at least one classes/jar source to build the API surface.
What it means
GradleException from KafkaPublicApiCheckerTask.checkPublicApi when projectJarFiles is empty. The checker needs at least one classes/jar source to build the API surface to compare against the javadoc jar. Empty input would yield a meaningless result, so it fails fast.
Solutions
- Configure the input: kafkaPublicApiChecker.projectJarFiles.from(tasks.named('jar')) or from the runtime/compile configuration of the module.
- Add dependsOn('jar') so the project jar exists at check time.
- If checking multiple modules, from(subprojects.collect { it.tasks.named('jar') }).
- If the module genuinely produces no jar, disable the task (enabled = false) rather than leaving it misconfigured.
Example fix
// before
kafkaPublicApiChecker {
javadocJarPath = ...
// projectJarFiles not set -> empty -> hard fail
}
// after
kafkaPublicApiChecker {
javadocJarPath = tasks.named('javadocJar').flatMap { it.archiveFile }
projectJarFiles.from(tasks.named('jar'))
} Defensive patterns
Strategy: validation
Validate before calling
// In build.gradle
tasks.named('kafkaPublicApiChecker').configure {
dependsOn 'jar'
doFirst {
assert !projectJarFiles.files.empty: 'kafkaPublicApiChecker.projectJarFiles is empty; wire tasks.named("jar")'
}
} Prevention
- Always from(tasks.named('jar')) on projectJarFiles.
- Add dependsOn('jar') so the jar exists at check time.
- Disable the task in modules that produce no jar.
When it happens
Trigger: projectJarFiles.getFiles().isEmpty() is true at line 88, inside the try block after the javadoc jar exists. Happens when the build script never sets kafkaPublicApiChecker.projectJarFiles, or sets it from a configuration that resolves to no artifacts.
Common situations: Applying the plugin without configuring projectJarFiles; pointing it at a configuration that is empty for the current variant; applying in a meta-module that produces no jar; the producing task has not run yet (no dependsOn).
Related errors
- No org.apache.kafka:* dependencies found on the configured…
- kafkaPublicApiChecker.javadocJarPath is not set. Either…
- No org.apache.kafka:* dependencies found on the project…
- Failed to check internal API usage
- Failed to check public API
AI-assisted analysis of apache/kafka@996fb4585a (2026-08-11).
Data as JSON: /api/errors/59248298df5f7264.
Report an issue: GitHub.
Appendix: source
Thrown at api-checker/gradle-plugins/src/main/java/org/apache/kafka/gradle/KafkaPublicApiCheckerTask.java:89
@TaskAction
public void checkPublicApi() {
if (!getCheckerEnabled().get()) {
getLogger().info("KafkaPublicApiChecker is disabled, skipping...");
return;
}
File jarFile = getJavadocJarFile();
if (!jarFile.exists()) {
throw new GradleException("Javadoc JAR file not found: " + jarFile.getAbsolutePath() +
". Make sure the javadoc task has run first.");
}
getLogger().info("Checking public API consistency in: {}", jarFile.getAbsolutePath());
try {
if (projectJarFiles.getFiles().isEmpty()) {
throw new GradleException(
"No project JARs configured on kafkaPublicApiChecker.projectJarFiles — "
+ "the checker needs at least one classes/jar source to build the API surface.");
}
PublicApiChecker checker = new PublicApiChecker(
new ArrayList<>(projectJarFiles.getFiles()),
new ArrayList<>(referenceJarFiles.getFiles()));
CheckResult result = checker.checkPublicApiConsistency(jarFile);
List<PublicApiViolation> violations = result.violations();
List<PublicApiViolation> suppressions = result.suppressions();
// Generate report
ViolationReporter reporter = new ViolationReporter();
File report = reportFile.get().getAsFile();
reporter.writeTextReport(violations, suppressions, report);
// Print summary to console
reporter.printToConsole(violations, suppressions);
View on GitHub (pinned to 996fb4585a)