This is an automated email from the ASF dual-hosted git repository. elharo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-jlink-plugin.git
The following commit(s) were added to refs/heads/master by this push: new 235a5de Replace two deprecated methods (#224) 235a5de is described below commit 235a5de6a478d252feb9e5a53e561a1d04a51754 Author: Elliotte Rusty Harold <elh...@users.noreply.github.com> AuthorDate: Sat Dec 7 18:42:53 2024 +0000 Replace two deprecated methods (#224) * Replace 2 deprecated methods --- .../java/org/apache/maven/plugins/jlink/JLinkMojo.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java b/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java index 2458017..b2704da 100644 --- a/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java +++ b/src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java @@ -41,10 +41,11 @@ import javax.inject.Inject; import java.io.File; import java.io.IOException; +import java.nio.file.attribute.FileTime; +import java.time.Instant; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; -import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -368,7 +369,7 @@ public class JLinkMojo extends AbstractJLinkMojo { private String outputTimestamp; /** - * These files are added to the image after calling the jlink, but before creating the zipfile. + * These files are added to the image after calling jlink, but before creating the zip file. * * @since 3.2.0 */ @@ -491,8 +492,8 @@ public class JLinkMojo extends AbstractJLinkMojo { Optional<Toolchain> toolchain = getToolchain(); if (toolchain.isPresent() && toolchain.orElseThrow(NoSuchElementException::new) instanceof DefaultJavaToolChain) { - Toolchain toolcahin1 = toolchain.orElseThrow(NoSuchElementException::new); - request.setJdkHome(new File(((DefaultJavaToolChain) toolcahin1).getJavaHome())); + Toolchain toolchain1 = toolchain.orElseThrow(NoSuchElementException::new); + request.setJdkHome(new File(((DefaultJavaToolChain) toolchain1).getJavaHome())); } ResolvePathsResult<File> resolvePathsResult = locationManager.resolvePaths(request); @@ -576,9 +577,9 @@ public class JLinkMojo extends AbstractJLinkMojo { zipArchiver.addDirectory(outputDirectoryImage); // configure for Reproducible Builds based on outputTimestamp value - Date lastModified = new MavenArchiver().parseOutputTimestamp(outputTimestamp); - if (lastModified != null) { - zipArchiver.configureReproducible(lastModified); + Optional<Instant> lastModified = MavenArchiver.parseBuildOutputTimestamp(outputTimestamp); + if (lastModified.isPresent()) { + zipArchiver.configureReproducibleBuild(FileTime.from(lastModified.get())); } File resultArchive = getArchiveFile(outputDirectory, finalName, getClassifier(), "zip");