elastic/elasticsearch · error · GradleException

Configuring a snapshot bwc distribution ('${distribution.get

Error message

Configuring a snapshot bwc distribution ('${distribution.getName()}') without a bundled JDK is not supported.

What it means

Thrown as GradleException in the 'bwc' DistributionResolution when an unreleased (snapshot) BWC distribution is configured without a bundled JDK. Snapshot BWC distributions are built from source as project dependencies, and the build system only supports building them with a bundled JDK (no-JDK distributions are a release-time packaging concern, not a source-build concern).

Source

Thrown at build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionDownloadPlugin.java:91

     * BWC versions are resolved as project to projects under `:distribution:bwc`.
     */
    private void registerInternalDistributionResolutions(List<DistributionResolution> resolutions, Provider<BwcVersions> bwcVersions) {
        resolutions.add(new DistributionResolution("local-build", (project, distribution) -> {
            if (isCurrentVersion(distribution) && distribution.isDetachedVersion() == false) {
                // non-external project, so depend on local build
                return new ProjectBasedDistributionDependency(
                    config -> projectDependency(project.getDependencies(), distributionProjectPath(distribution), config)
                );
            }
            return null;
        }));

        resolutions.add(new DistributionResolution("bwc", (project, distribution) -> {
            BwcVersions.UnreleasedVersionInfo unreleasedInfo = bwcVersions.get()
                .unreleasedInfo(Version.fromString(distribution.getVersion()));
            if (unreleasedInfo != null && distribution.isDetachedVersion() == false) {
                if (distribution.getBundledJdk() == false) {
                    throw new GradleException(
                        "Configuring a snapshot bwc distribution ('"
                            + distribution.getName()
                            + "') "
                            + "without a bundled JDK is not supported."
                    );
                }
                String projectConfig = getProjectConfig(distribution, unreleasedInfo);
                return new ProjectBasedDistributionDependency(
                    (config) -> projectDependency(project.getDependencies(), unreleasedInfo.gradleProjectPath(), projectConfig)
                );
            }
            return null;
        }));

        // Distribution resolution for "detached" versions. This allows for building from source for any version, including the current
        // version of existing released versions from a commit form the main branch. This is done by passing certain system properties, ex:
        //
        // -Dtests.bwc.refspec.main=deadbeef -Dtests.bwc.main.version=9.0.0

View on GitHub (pinned to db6a809a66)

Solutions

  1. Configure the BWC distribution with a bundled JDK: ensure distribution.getBundledJdk() returns true for snapshot BWC versions.
  2. If testing the no-JDK variant is required, use a released (non-snapshot) version via DRA instead of building from source.
  3. Review the distribution definition under :distribution:bwc:<version> to confirm it produces a bundled-JDK archive.

Example fix

// before: snapshot BWC dist configured without bundled JDK → throws
distribution.setBundledJdk(false);

// after: bundle the JDK for snapshot BWC builds
distribution.setBundledJdk(true);
Defensive patterns

Strategy: validation

Validate before calling

if (unreleasedInfo != null && distribution.isDetachedVersion() == false && distribution.getBundledJdk() == false) {
    throw new IllegalStateException("Snapshot BWC '" + distribution.getName() + "' requires bundled JDK; refusing to configure.");
}

Prevention

When it happens

Trigger: In registerInternalDistributionResolutions (line 86), when bwcVersions.unreleasedInfo(version) returns non-null (this is a snapshot/unreleased version) and distribution.isDetachedVersion() is false, the code checks distribution.getBundledJdk(). If false, it throws — the combination (snapshot BWC + no bundled JDK) is unsupported.

Common situations: A distribution configuration or test harness requests an unreleased BWC version with bundledJdk=false (intending to test the no-JDK variant); a new BWC version was added but the bundled-JDK distribution wasn't the one wired up; misconfiguration of distribution.getBundledJdk() in the test fixture.

Related errors


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