GoogleContainerTools/jib · error · MojoExecutionException

<message from IncompatibleBaseImageJavaVersionException via

Error message

<message from IncompatibleBaseImageJavaVersionException via HelpfulSuggestions.forIncompatibleBaseImageJavaVersionForMaven>

What it means

jib-maven-plugin throws this when the project's Java version is too old for the configured base image. HelpfulSuggestions.forIncompatibleBaseImageJavaVersionForMaven produces a message comparing the base image's major Java version with the project's major Java version. It exists because base images like eclipse-temurin:17 run Java 17 and cannot host an app compiled for an older bytecode level incompatibly, or vice versa the project requires a newer JDK than the base image provides.

Source

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

              + "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. Change the base image (<from><image>) to one matching the project's Java version, e.g. eclipse-temurin:17 for Java 17.
  2. Alternatively lower maven.compiler.target/java.version to match the base image's Java version.
  3. Read the exception message: it states the base image major version and the project major version; align the lower/higher one as intended.

Example fix

<!-- before -->
<from><image>eclipse-temurin:8</image></from>
<properties><maven.compiler.target>17</maven.compiler.target></properties>
<!-- after -->
<from><image>eclipse-temurin:17</image></from>
<properties><maven.compiler.target>17</maven.compiler.target></properties>
Defensive patterns

Strategy: validation

Validate before calling

int projectJava = Integer.parseInt(System.getProperty("java.version").split("\\.")[0].replace("1.", ""));
String baseImage = "eclipse-temurin:17";
int baseJava = Integer.parseInt(baseImage.replaceAll(".*:(\\d+).*", "$1"));
if (baseJava != projectJava) throw new IllegalStateException(
    "base image Java " + baseJava + " does not match project Java " + projectJava);

Try / catch

try { ... } catch (MojoExecutionException e) { if (e.getMessage().contains("Java version")) { /* fix base image or compiler target */ } throw e; }

Prevention

When it happens

Trigger: Running 'mvn jib:build' (BuildImageMojo.execute) where the <from><image> base image major Java version is incompatible with the project's java.version/maven.compiler.target (IncompatibleBaseImageJavaVersionException), e.g. base image Java 8 with a project compiled for Java 17.

Common situations: Upgrading the project from Java 8 to 11/17 without updating the base image tag; copying a base image like eclipse-temurin:8 from an old pom; using 'latest'-style tags that resolve to a newer JDK than the compiler target.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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