{"record":{"id":"59248298df5f7264","repo":"apache/kafka","slug":"no-project-jars-configured-on-kafkapublicapichecke","errorCode":null,"errorMessage":"No project JARs configured on kafkaPublicApiChecker.projectJarFiles — the checker needs at least one classes/jar source to build the API surface.","messagePattern":"No project JARs configured on kafkaPublicApiChecker\\.projectJarFiles — the checker needs at least one classes/jar source to build the API surface\\.","errorType":"validation","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"api-checker/gradle-plugins/src/main/java/org/apache/kafka/gradle/KafkaPublicApiCheckerTask.java","lineNumber":89,"sourceCode":"\n    @TaskAction\n    public void checkPublicApi() {\n        if (!getCheckerEnabled().get()) {\n            getLogger().info(\"KafkaPublicApiChecker is disabled, skipping...\");\n            return;\n        }\n\n        File jarFile = getJavadocJarFile();\n        if (!jarFile.exists()) {\n            throw new GradleException(\"Javadoc JAR file not found: \" + jarFile.getAbsolutePath() +\n                \". Make sure the javadoc task has run first.\");\n        }\n\n        getLogger().info(\"Checking public API consistency in: {}\", jarFile.getAbsolutePath());\n\n        try {\n            if (projectJarFiles.getFiles().isEmpty()) {\n                throw new GradleException(\n                        \"No project JARs configured on kafkaPublicApiChecker.projectJarFiles — \"\n                        + \"the checker needs at least one classes/jar source to build the API surface.\");\n            }\n            PublicApiChecker checker = new PublicApiChecker(\n                new ArrayList<>(projectJarFiles.getFiles()),\n                new ArrayList<>(referenceJarFiles.getFiles()));\n            CheckResult result = checker.checkPublicApiConsistency(jarFile);\n            List<PublicApiViolation> violations = result.violations();\n            List<PublicApiViolation> suppressions = result.suppressions();\n\n            // Generate report\n            ViolationReporter reporter = new ViolationReporter();\n            File report = reportFile.get().getAsFile();\n            reporter.writeTextReport(violations, suppressions, report);\n\n            // Print summary to console\n            reporter.printToConsole(violations, suppressions);\n","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/apache/kafka/blob/996fb4585aa1bcc8980b0e1b8d6b168b986cd979/api-checker/gradle-plugins/src/main/java/org/apache/kafka/gradle/KafkaPublicApiCheckerTask.java#L71-L107","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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."],"exampleFix":"// before\nkafkaPublicApiChecker {\n  javadocJarPath = ...\n  // projectJarFiles not set -> empty -> hard fail\n}\n// after\nkafkaPublicApiChecker {\n  javadocJarPath = tasks.named('javadocJar').flatMap { it.archiveFile }\n  projectJarFiles.from(tasks.named('jar'))\n}","handlingStrategy":"validation","validationCode":"// In build.gradle\ntasks.named('kafkaPublicApiChecker').configure {\n  dependsOn 'jar'\n  doFirst {\n    assert !projectJarFiles.files.empty: 'kafkaPublicApiChecker.projectJarFiles is empty; wire tasks.named(\"jar\")'\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["gradle","api-checker","configuration","build"],"backgroundTag":null,"analyzedSha":"996fb4585aa1bcc8980b0e1b8d6b168b986cd979","analyzedAt":"2026-08-11T22:03:28.655Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}