{"id":"01eed2a0e07ccc12","repo":"apache/kafka","slug":"no-org-apache-kafka-dependencies-found-on-the-co","errorCode":null,"errorMessage":"No org.apache.kafka:* dependencies found on the configured kafkaDependencyJars. The checker cannot derive an API surface and would produce a meaningless '0 violations' report — likely a classpath or configuration issue.","messagePattern":"No org\\.apache\\.kafka:\\* dependencies found on the configured kafkaDependencyJars\\. The checker cannot derive an API surface and would produce a meaningless '0 violations' report — likely a classpath or configuration issue\\.","errorType":"exception","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"api-checker/gradle-plugins/src/main/java/org/apache/kafka/gradle/KafkaInternalApiCheckerTask.java","lineNumber":108,"sourceCode":"            return;\n        }\n\n        List<File> classRoots = PublicApiChecker.collectExistingRoots(classes.getFiles());\n        if (classRoots.isEmpty()) {\n            getLogger().info(\"No class files found, skipping internal API check\");\n            return;\n        }\n\n        runCheck(kafkaJars, classRoots);\n    }\n\n    private void handleNoKafkaDependency() {\n        String msg = \"No org.apache.kafka:* dependencies found on the configured \"\n                + \"kafkaDependencyJars. The checker cannot derive an API surface and would \"\n                + \"produce a meaningless '0 violations' report — likely a classpath or \"\n                + \"configuration issue.\";\n        if (failOnNoKafkaDependency.get()) {\n            throw new GradleException(msg);\n        }\n        getLogger().warn(\"{} Skipping internal API check. \"\n                + \"Set kafkaInternalApiChecker.failOnNoKafkaDependency = true to make this fatal.\", msg);\n    }\n\n    private void runCheck(List<File> kafkaJars, List<File> classRoots) {\n        try {\n            getLogger().info(\"Scanning {} class file root(s) for internal API usage\", classRoots.size());\n            CheckResult result = new PublicApiChecker(kafkaJars).checkBytecode(classRoots);\n            reportResults(result);\n        } catch (IOException e) {\n            throw new GradleException(\"Failed to check internal API usage: \" + e.getMessage(), e);\n        }\n    }\n\n    private void reportResults(CheckResult result) throws IOException {\n        List<PublicApiViolation> violations = result.violations();\n        List<PublicApiViolation> suppressions = result.suppressions();","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/apache/kafka/blob/c31c9215e131f8c17e79f8901b48c13ee6aa8e7a/api-checker/gradle-plugins/src/main/java/org/apache/kafka/gradle/KafkaInternalApiCheckerTask.java#L90-L126","documentation":"Thrown by the Gradle KafkaInternalApiCheckerTask when failOnNoKafkaDependency is true and the kafkaDependencyJars file collection resolves to no org.apache.kafka artifacts. The checker needs those jars because the @InterfaceAudience.Public annotations on their classes define the legal API surface; without them it cannot distinguish public from internal types and would emit a misleading '0 violations'. Default is failOnNoKafkaDependency=false (warn-and-skip), so seeing this exception means a build script explicitly opted into the strict mode.","triggerScenarios":"KafkaInternalApiCheckerTask.handleNoKafkaDependency() at line 108 is reached when kafkaJars.isEmpty() (line 88) AND failOnNoKafkaDependency.get() returns true. The task is invoked (e.g. ./gradlew checkInternalApiUsage) on a project whose compile classpath contains no org.apache.kafka:* artifact, or whose plugin wiring (filtered to org.apache.kafka) resolved to nothing.","commonSituations":"A Kafka-dependent module that lost its kafka-clients/kafka-streams dependency after a refactor; a multi-module build where the plugin is applied to a subproject that uses a transitive Kafka dependency not captured by the org.apache.kafka filter; a freshly added module where the dependency declaration was forgotten; CI after a version coordinate change (e.g. switching groupId or using a shaded kafka jar).","solutions":["Add the Kafka dependency to the module, e.g. implementation 'org.apache.kafka:kafka-clients:3.8.0' (or kafka-streams), then re-run the task.","If the dependency is provided transitively through a non-org.apache.kafka coordinate, explicitly wire it onto kafkaInternalApiChecker.kafkaDependencyJars.from(configurations.compileClasspath.filter { it.name.contains('kafka') }).","If the module genuinely should not be checked, disable the task (kafkaInternalApiChecker.enabled = false) or remove the plugin from that subproject instead of leaving it running with no surface.","Only as a last resort on a project that legitimately has no Kafka surface, keep failOnNoKafkaDependency = false (the default) so the check is skipped with a warning rather than failing the build."],"exampleFix":"// before\nkafkaInternalApiChecker {\n  failOnNoKafkaDependency = true\n}\n// (module has no org.apache.kafka dependency)\n\n// after — add the dependency the checker needs to derive the API surface\ndependencies {\n  implementation 'org.apache.kafka:kafka-clients:3.8.0'\n}","handlingStrategy":"validation","validationCode":"from release.notes import query\n\ndef has_issues_for_version(version):\n    \"\"\"Return True if at least one KAFKA issue is tagged with fixVersion=version.\"\"\"\n    issues = query(f\"project=KAFKA and fixVersion={version}\")\n    return len(issues) > 0\n\n# Caller-side guard before invoking generate(version):\nif not has_issues_for_version(version):\n    raise SystemExit(f\"No issues found for version {version}; aborting release-notes generation.\")\nhtml = generate(version)","typeGuard":null,"tryCatchPattern":"try:\n    html = generate(version)\nexcept Exception as e:\n    if \"Didn't find any issues for version\" in str(e):\n        # Empty/unreleased version: skip or fail gracefully\n        sys.exit(f\"Skipping {version}: no issues tagged.\")\n    raise  # re-raise unrelated errors","preventionTips":["Confirm the version string exactly matches a JIRA fixVersion that already has issues tagged (e.g. '3.9.0', not '3.9') before invoking generate().","Run generate() only after issues have been tagged with the target fixVersion in JIRA, not before.","Verify JIRA connectivity and that the KAFKA project contains the version before scripting release notes.","Cache or log the query result count separately so an empty result is visible as a data gap rather than an opaque exception."],"tags":["gradle","kafka","api-checker","classpath","configuration"],"analyzedSha":"c31c9215e131f8c17e79f8901b48c13ee6aa8e7a","analyzedAt":"2026-08-03T12:34:05.770Z","schemaVersion":2}