GoogleContainerTools/jib · error · GradleException

Detected ${GradleVersion.current()}, but jib requires ${GRAD

Error message

Detected ${GradleVersion.current()}, but jib requires ${GRADLE_MIN_VERSION} or higher. You can upgrade by running 'gradle wrapper --gradle-version=${GRADLE_MIN_VERSION.getVersion()}'.

What it means

JibPlugin.apply calls checkGradleVersion, which compares the running Gradle version (GradleVersion.current()) against Jib's minimum supported Gradle version (GRADLE_MIN_VERSION). If the project's Gradle is older than the minimum, plugin application fails immediately with a GradleException telling the user how to upgrade the wrapper.

Source

Thrown at jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/JibPlugin.java:58

public class JibPlugin implements Plugin<Project> {

  @VisibleForTesting static final GradleVersion GRADLE_MIN_VERSION = GradleVersion.version("5.1");

  public static final String JIB_EXTENSION_NAME = "jib";
  public static final String BUILD_IMAGE_TASK_NAME = "jib";
  public static final String BUILD_TAR_TASK_NAME = "jibBuildTar";
  public static final String BUILD_DOCKER_TASK_NAME = "jibDockerBuild";
  public static final String SKAFFOLD_FILES_TASK_V2_NAME = "_jibSkaffoldFilesV2";
  public static final String SKAFFOLD_INIT_TASK_NAME = "_jibSkaffoldInit";
  public static final String SKAFFOLD_SYNC_MAP_TASK_NAME = "_jibSkaffoldSyncMap";
  public static final String SKAFFOLD_CHECK_REQUIRED_VERSION_TASK_NAME =
      "_skaffoldFailIfJibOutOfDate";

  public static final String REQUIRED_VERSION_PROPERTY_NAME = "jib.requiredVersion";

  private static void checkGradleVersion() {
    if (GRADLE_MIN_VERSION.compareTo(GradleVersion.current()) > 0) {
      throw new GradleException(
          "Detected "
              + GradleVersion.current()
              + ", but jib requires "
              + GRADLE_MIN_VERSION
              + " or higher. You can upgrade by running 'gradle wrapper --gradle-version="
              + GRADLE_MIN_VERSION.getVersion()
              + "'.");
    }
  }

  /** Check the Jib version matches the required version (if specified). */
  private static void checkJibVersion() {
    // todo: should retrieve from project properties?
    String requiredVersion = System.getProperty(REQUIRED_VERSION_PROPERTY_NAME);
    if (requiredVersion == null) {
      return;
    }
    String actualVersion = GradleProjectProperties.TOOL_VERSION;

View on GitHub (pinned to fb949e2676)

Solutions

  1. Run `gradle wrapper --gradle-version=<GRADLE_MIN_VERSION>` (or newer) as the error message suggests
  2. Edit gradle/wrapper/gradle-wrapper.properties distributionUrl to a supported Gradle version and re-sync
  3. In the IDE, switch Gradle to 'Use Gradle from: gradle-wrapper.properties' or update the IDE's Gradle version
  4. If Gradle cannot be upgraded, pin/downgrade the Jib plugin to a version supporting your Gradle

Example fix

// before: gradle/wrapper/gradle-wrapper.properties
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip
// after
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
Defensive patterns

Strategy: validation

Validate before calling

def required = '7.0' // Jib's GRADLE_MIN_VERSION
if (org.gradle.util.GradleVersion.current().compareTo(org.gradle.util.GradleVersion.version(required)) < 0) {
  throw new GradleException("Gradle ${required}+ required; wrapper must be upgraded")
}

Try / catch

try {
  apply plugin: 'com.google.cloud.tools.jib'
} catch (GradleException e) {
  if (e.message.contains('jib requires')) {
    throw new GradleException('Upgrade the Gradle wrapper: ' + e.message)
  } else { throw e }
}

Prevention

When it happens

Trigger: Applying the Jib plugin (plugins { id 'com.google.cloud.tools.jib' }) with a Gradle version below GRADLE_MIN_VERSION; typically an old gradle-wrapper.properties distribution URL or an outdated IDE-bundled Gradle.

Common situations: Cloning an old project whose wrapper predates the Jib plugin's minimum; CI images with a pinned old Gradle; IDE (IntelliJ/Eclipse) using its own Gradle installation instead of the wrapper; upgrading the Jib plugin without upgrading Gradle.

Related errors


AI-assisted analysis of GoogleContainerTools/jib@fb949e2676 (2026-09-06). Data as JSON: /api/errors/9952e2029d167b0b. Report an issue: GitHub.