diff --git a/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java b/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java index 3b93e633ec946..9f7a2b4330bb4 100644 --- a/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java +++ b/extensions/container-image/container-image-jib/deployment/src/main/java/io/quarkus/container/image/jib/deployment/JibProcessor.java @@ -540,15 +540,20 @@ private JibContainerBuilder createContainerBuilderFromFastJar(String baseJvmImag FileEntriesLayer.Builder bootLibsLayerBuilder = FileEntriesLayer.builder().setName("fast-jar-boot-libs"); Path bootLibPath = componentsPath.resolve(JarResultBuildStep.LIB).resolve(JarResultBuildStep.BOOT_LIB); - try (Stream boolLibPaths = Files.list(bootLibPath)) { - boolLibPaths.forEach(lib -> { + try (Stream bootLibPaths = Files.list(bootLibPath)) { + bootLibPaths.forEach(lib -> { try { AbsoluteUnixPath libPathInContainer = workDirInContainer.resolve(JarResultBuildStep.LIB) .resolve(JarResultBuildStep.BOOT_LIB) .resolve(lib.getFileName()); - // the boot lib jars need to preserve the modification time because otherwise AppCDS won't work - bootLibsLayerBuilder.addEntry(lib, libPathInContainer, - Files.getLastModifiedTime(lib).toInstant()); + Instant bootLibModificationTime; + if (appCDSResult.isPresent()) { + // the boot lib jars need to preserve the modification time because otherwise AppCDS won't work + bootLibModificationTime = Files.getLastModifiedTime(lib).toInstant(); + } else { + bootLibModificationTime = modificationTime; + } + bootLibsLayerBuilder.addEntry(lib, libPathInContainer, bootLibModificationTime); } catch (IOException e) { throw new UncheckedIOException(e); }