{"record":{"id":"18ed9e67c70bb543","repo":"GoogleContainerTools/jib","slug":"message-from-incompatiblebaseimagejavaversionexce-18ed9e","errorCode":null,"errorMessage":"<message from IncompatibleBaseImageJavaVersionException via HelpfulSuggestions.forIncompatibleBaseImageJavaVersionForMaven>","messagePattern":"<message from IncompatibleBaseImageJavaVersionException via HelpfulSuggestions\\.forIncompatibleBaseImageJavaVersionForMaven>","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/BuildImageMojo.java","lineNumber":165,"sourceCode":"              + \"DateTimeFormatter.ISO_DATE_TIME) or special keyword \\\"EPOCH_PLUS_SECOND\\\": \"\n              + ex.getInvalidFilesModificationTime(),\n          ex);\n\n    } catch (InvalidCreationTimeException ex) {\n      throw new MojoExecutionException(\n          \"<container><creationTime> should be an ISO 8601 date-time (see \"\n              + \"DateTimeFormatter.ISO_DATE_TIME) or a special keyword (\\\"EPOCH\\\", \"\n              + \"\\\"USE_CURRENT_TIMESTAMP\\\"): \"\n              + ex.getInvalidCreationTime(),\n          ex);\n\n    } catch (JibPluginExtensionException ex) {\n      String extensionName = ex.getExtensionClass().getName();\n      throw new MojoExecutionException(\n          \"error running extension '\" + extensionName + \"': \" + ex.getMessage(), ex);\n\n    } catch (IncompatibleBaseImageJavaVersionException ex) {\n      throw new MojoExecutionException(\n          HelpfulSuggestions.forIncompatibleBaseImageJavaVersionForMaven(\n              ex.getBaseImageMajorJavaVersion(), ex.getProjectMajorJavaVersion()),\n          ex);\n\n    } catch (InvalidImageReferenceException ex) {\n      throw new MojoExecutionException(\n          HelpfulSuggestions.forInvalidImageReference(ex.getInvalidReference()), ex);\n\n    } catch (IOException\n        | CacheDirectoryCreationException\n        | MainClassInferenceException\n        | InvalidGlobalConfigException ex) {\n      throw new MojoExecutionException(ex.getMessage(), ex);\n\n    } catch (BuildStepsExecutionException ex) {\n      throw new MojoExecutionException(ex.getMessage(), ex.getCause());\n\n    } catch (ExtraDirectoryNotFoundException ex) {","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-maven-plugin/src/main/java/com/google/cloud/tools/jib/maven/BuildImageMojo.java#L147-L183","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Change the base image (<from><image>) to one matching the project's Java version, e.g. eclipse-temurin:17 for Java 17.","Alternatively lower maven.compiler.target/java.version to match the base image's Java version.","Read the exception message: it states the base image major version and the project major version; align the lower/higher one as intended."],"exampleFix":"<!-- before -->\n<from><image>eclipse-temurin:8</image></from>\n<properties><maven.compiler.target>17</maven.compiler.target></properties>\n<!-- after -->\n<from><image>eclipse-temurin:17</image></from>\n<properties><maven.compiler.target>17</maven.compiler.target></properties>","handlingStrategy":"validation","validationCode":"int projectJava = Integer.parseInt(System.getProperty(\"java.version\").split(\"\\\\.\")[0].replace(\"1.\", \"\"));\nString baseImage = \"eclipse-temurin:17\";\nint baseJava = Integer.parseInt(baseImage.replaceAll(\".*:(\\\\d+).*\", \"$1\"));\nif (baseJava != projectJava) throw new IllegalStateException(\n    \"base image Java \" + baseJava + \" does not match project Java \" + projectJava);","typeGuard":null,"tryCatchPattern":"try { ... } catch (MojoExecutionException e) { if (e.getMessage().contains(\"Java version\")) { /* fix base image or compiler target */ } throw e; }","preventionTips":["Keep the base image tag's Java version aligned with maven.compiler.target","Prefer explicit versioned base image tags over floating tags","Centralize the Java version in a pom property referenced by both the compiler plugin and documentation"],"tags":["maven","jib","java-version","base-image","configuration"],"backgroundTag":"invalid-config-value","analyzedSha":"fb949e2676afbbd7dd7a1ef61e20251931325654","analyzedAt":"2026-09-06T14:04:09.491Z","contentChangedAt":"2026-09-06T14:04:09.491Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}