GoogleContainerTools/jib · error · MojoExecutionException

<message from IncompatibleBaseImageJavaVersionException via

Error message

<message from IncompatibleBaseImageJavaVersionException via HelpfulSuggestions.forIncompatibleBaseImageJavaVersionForMaven>

What it means

Thrown as a MojoExecutionException from BuildTarMojo.execute when the project's Java major version is incompatible with the base image's Java version (IncompatibleBaseImageJavaVersionException). The message is produced by HelpfulSuggestions.forIncompatibleBaseImageJavaVersionForMaven and suggests a matching base image for your project's Java version.

Source

Thrown at jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/BuildTarMojo.java:143

              + "DateTimeFormatter.ISO_DATE_TIME) or special keyword \"EPOCH_PLUS_SECOND\": "
              + ex.getInvalidFilesModificationTime(),
          ex);

    } catch (InvalidCreationTimeException ex) {
      throw new MojoExecutionException(
          "<container><creationTime> should be an ISO 8601 date-time (see "
              + "DateTimeFormatter.ISO_DATE_TIME) or a special keyword (\"EPOCH\", "
              + "\"USE_CURRENT_TIMESTAMP\"): "
              + ex.getInvalidCreationTime(),
          ex);

    } catch (JibPluginExtensionException ex) {
      String extensionName = ex.getExtensionClass().getName();
      throw new MojoExecutionException(
          "error running extension '" + extensionName + "': " + ex.getMessage(), ex);

    } catch (IncompatibleBaseImageJavaVersionException ex) {
      throw new MojoExecutionException(
          HelpfulSuggestions.forIncompatibleBaseImageJavaVersionForMaven(
              ex.getBaseImageMajorJavaVersion(), ex.getProjectMajorJavaVersion()),
          ex);

    } catch (InvalidImageReferenceException ex) {
      throw new MojoExecutionException(
          HelpfulSuggestions.forInvalidImageReference(ex.getInvalidReference()), ex);

    } catch (IOException
        | CacheDirectoryCreationException
        | MainClassInferenceException
        | InvalidGlobalConfigException ex) {
      throw new MojoExecutionException(ex.getMessage(), ex);

    } catch (BuildStepsExecutionException ex) {
      throw new MojoExecutionException(ex.getMessage(), ex.getCause());

    } catch (ExtraDirectoryNotFoundException ex) {

View on GitHub (pinned to fb949e2676)

Solutions

  1. Update <from><image> to a base image matching or exceeding your project's Java version (the error text names the required version).
  2. For Jib-provided images, switch to the variant for your major version, e.g. gcr.io/jib-runtime-image:21 or eclipse-temurin:21-jre.
  3. Alternatively lower the project's Java version (maven.compiler.source/target or release flag) if it must match an older base image.
  4. Check for a parent POM or profile pinning an old base image and update it there.

Example fix

// before
<from><image>gcr.io/jib-runtime-image:11</image></from>
// after
<from><image>gcr.io/jib-runtime-image:21</image></from>
Defensive patterns

Strategy: validation

Validate before calling

// Verify project vs base image Java versions before building
String target = project.getProperties().getProperty("maven.compiler.target");
String baseImageJava = "17"; // major version of the chosen base image
if (Integer.parseInt(target) > Integer.parseInt(baseImageJava)) {
  throw new IllegalStateException("Base image Java " + baseImageJava + " < project target " + target);
}

Prevention

When it happens

Trigger: Building with <from><image> set to a Jib-provided base image (e.g. gcr.io/jib-runtime-image or distroless java) whose major Java version (e.g. 17) is lower than the project's compile target (e.g. maven.compiler.target=21).

Common situations: After upgrading the project to a newer JDK (e.g. 11 -> 17 or 17 -> 21) without updating the base image; using the default jib-runtime-style image pinned to an older Java.

Related errors


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