{"record":{"id":"fb9258b9834c1492","repo":"GoogleContainerTools/jib","slug":"your-project-is-using-java-projectmajorjavaversi","errorCode":null,"errorMessage":"Your project is using Java ${projectMajorJavaVersion} but the base image is for Java ${baseImageMajorJavaVersion}, perhaps you should configure a Java ${projectMajorJavaVersion}-compatible base image using the 'jib.from.image' parameter, or set targetCompatibility = ${baseImageMajorJavaVersion} or below in your build configuration","messagePattern":"Your project is using Java (.+?) but the base image is for Java (.+?), perhaps you should configure a Java (.+?)-compatible base image using the 'jib\\.from\\.image' parameter, or set targetCompatibility = (.+?) or below in your build configuration","errorType":"console","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildDockerTask.java","lineNumber":175,"sourceCode":"              + \"DateTimeFormatter.ISO_DATE_TIME) or special keyword \\\"EPOCH_PLUS_SECOND\\\": \"\n              + ex.getInvalidFilesModificationTime(),\n          ex);\n\n    } catch (InvalidCreationTimeException ex) {\n      throw new GradleException(\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 GradleException(\n          \"error running extension '\" + extensionName + \"': \" + ex.getMessage(), ex);\n\n    } catch (IncompatibleBaseImageJavaVersionException ex) {\n      throw new GradleException(\n          HelpfulSuggestions.forIncompatibleBaseImageJavaVersionForGradle(\n              ex.getBaseImageMajorJavaVersion(), ex.getProjectMajorJavaVersion()),\n          ex);\n\n    } catch (InvalidImageReferenceException ex) {\n      throw new GradleException(\n          HelpfulSuggestions.forInvalidImageReference(ex.getInvalidReference()), ex);\n\n    } catch (ExtraDirectoryNotFoundException ex) {\n      throw new GradleException(\n          \"extraDirectories.paths contain \\\"from\\\" directory that doesn't exist locally: \"\n              + ex.getPath(),\n          ex);\n    } finally {\n      tempDirectoryProvider.close();\n      TaskCommon.finishUpdateChecker(projectProperties, updateCheckFuture);\n      projectProperties.waitForLoggingThread();\n    }","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/GoogleContainerTools/jib/blob/fb949e2676afbbd7dd7a1ef61e20251931325654/jib-gradle-plugin/src/main/java/com/google/cloud/tools/jib/gradle/BuildDockerTask.java#L157-L193","documentation":"Thrown when the base image's Java major version is lower than the project's Java version, i.e. the base image cannot run the compiled bytecode. Jib detects the Java version of the base image (e.g. from eu.gcr.io/jib-core base images like eclipse-temurin:8) and fails with a helpful suggestion via HelpfulSuggestions.forIncompatibleBaseImageJavaVersionForGradle.","triggerScenarios":"Building a project with source/targetCompatibility (or toolchain) Java 17 while using a base image built for Java 8 or 11 (e.g. 'openjdk:8-jre'), so the compiled classes (class file version) would not run on the base image's JRE.","commonSituations":"Upgrading a project to a newer JDK without updating jib.from.image; inheriting an old base image from a template; CI using a newer JDK than the Dockerfile-era base image.","solutions":["Update jib.from.image to a base image matching your Java version, e.g. 'eclipse-temurin:17-jre'","Or lower targetCompatibility/sourceCompatibility to the base image's Java version","Or configure a Java toolchain matching the base image","Check the reported versions in the error message to pick the right image tag"],"exampleFix":"// before\njib { from { image = 'openjdk:8-jre' } } // project targets Java 17\n// after\njib { from { image = 'eclipse-temurin:17-jre' } }","handlingStrategy":"validation","validationCode":"def projectJava = JavaVersion.current().majorVersion.toInteger()\ndef baseImage = jib.from.image ?: 'eclipse-temurin:8-jre'\ndef baseJava = (baseImage =~ /:(\\d+)/) ? ((baseImage =~ /:(\\d+)/)[0][1] as Integer) : 8\nif (projectJava > baseJava) {\n  logger.warn(\"Project Java $projectJava > base image Java $baseJava — update jib.from.image\")\n}","typeGuard":null,"tryCatchPattern":"try { jibBuild.run() } catch (GradleException e) { if (e.message.contains('base image is for Java')) { logger.error(e.message + \" — align jib.from.image with targetCompatibility\") }; throw e }","preventionTips":["When upgrading the project's JDK, update jib.from.image in the same change","Keep base image Java version >= project targetCompatibility","Use Jib's default base image matching your toolchain, or pin explicit versioned tags"],"tags":["gradle","jib","java-version","base-image"],"backgroundTag":"incompatible-source-type","analyzedSha":"fb949e2676afbbd7dd7a1ef61e20251931325654","analyzedAt":"2026-09-06T14:04:09.491Z","contentChangedAt":"2026-09-06T14:04:09.491Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}