elastic/elasticsearch · error · GradleException

Unknown JDK vendor [${vendor}]

Error message

Unknown JDK vendor [${vendor}]

What it means

Thrown by JdkDownloadPlugin.setupRepository in the final else branch when jdk.getVendor() is neither 'adoptium', 'openjdk', nor 'zulu'. Because Jdk.setVendor already rejects any vendor outside ALLOWED_VENDORS (the same three values) at configuration time, this branch is a defensive duplicate that is effectively unreachable for Jdk instances created through the normal container — it guards against a future divergence between the allowlist and the plugin's if/else chain.

Source

Thrown at build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/JdkDownloadPlugin.java:164

                        + jdk.getMajor()
                        + "/"
                        + jdk.getBuild()
                        + "/GPL/openjdk-[revision]_[module]-[classifier]_bin.[ext]";
                }
            }
        } else if (jdk.getVendor().equals(VENDOR_ZULU)) {
            repoUrl = "https://cdn.azul.com";
            if (jdk.getMajor().equals("8") && isJdkOnMacOsPlatform(jdk) && jdk.getArchitecture().equals("aarch64")) {
                artifactPattern = "zulu/bin/zulu"
                    + jdk.getDistributionVersion()
                    + "-ca-jdk"
                    + jdk.getBaseVersion().replace("u", ".0.")
                    + "-[module]x_[classifier].[ext]";
            } else {
                throw new GradleException("JDK vendor zulu is supported only for JDK8 on MacOS with Apple Silicon.");
            }
        } else {
            throw new GradleException("Unknown JDK vendor [" + jdk.getVendor() + "]");
        }

        // Define the repository if we haven't already
        if (repositories.findByName(repoName) == null) {
            repositories.ivy(repo -> {
                repo.setName(repoName);
                repo.setUrl(repoUrl);
                repo.metadataSources(IvyArtifactRepository.MetadataSources::artifact);
                repo.patternLayout(layout -> layout.artifact(artifactPattern));
                repo.content(repositoryContentDescriptor -> repositoryContentDescriptor.includeGroup(groupName(jdk)));
            });
        }
    }

    @SuppressWarnings("unchecked")
    public static NamedDomainObjectContainer<Jdk> getContainer(Project project) {
        return (NamedDomainObjectContainer<Jdk>) project.getExtensions().getByName(EXTENSION_NAME);
    }

View on GitHub (pinned to db6a809a66)

Solutions

  1. Use only 'adoptium', 'openjdk', or 'zulu' as the vendor.
  2. If you are extending build tooling to support a new vendor, add it to BOTH Jdk.ALLOWED_VENDORS and a new branch in JdkDownloadPlugin.setupRepository with a concrete repoUrl and artifactPattern — otherwise this defensive throw will fire.
Defensive patterns

Strategy: validation

Validate before calling

// Unreachable through normal Jdk construction because setVendor already
// rejects non-allowlisted vendors. As a build-tooling author, keep
// Jdk.ALLOWED_VENDORS and the if/else chain in JdkDownloadPlugin in sync:
assert ALLOWED_VENDORS.equals(List.of("adoptium", "openjdk", "zulu"));
// every vendor in ALLOWED_VENDORS must have a branch in setupRepository.

Prevention

When it happens

Trigger: setupRepository is reached with a Jdk whose vendor is not one of the three handled cases. Requires either bypassing Jdk.setVendor's validation or the allowlist and the if/else chain drifting out of sync.

Common situations: A future change that adds a vendor to ALLOWED_VENDORS in Jdk.java without adding a corresponding branch (and repository definition) in JdkDownloadPlugin.setupRepository; reflective/test construction that sets the Property without the setter's guard.

Related errors


AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12). Data as JSON: /api/errors/a2230cd10f899e9c. Report an issue: GitHub.