Skip to content

Commit

Permalink
Replace 3 deprecated methods
Browse files Browse the repository at this point in the history
  • Loading branch information
elharo committed Dec 2, 2024
1 parent 022d9e5 commit 20e27e3
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/main/java/org/apache/maven/plugins/jlink/JLinkMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,11 @@

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;
Expand Down Expand Up @@ -373,7 +374,7 @@ public class JLinkMojo extends AbstractJLinkMojo {
private MavenProjectHelper projectHelper;

/**
* These file are added to the image after calling the jlink, but before creating the zipfile.
* These files are added to the image after calling the jlink, but before creating the zipfile.
*
* @since 3.2.0
*/
Expand Down Expand Up @@ -478,8 +479,8 @@ private Map<String, File> getModulePathElements() throws MojoFailureException {
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);
Expand Down Expand Up @@ -563,9 +564,9 @@ private File createZipArchiveFromImage(File outputDirectory, File outputDirector
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 = new MavenArchiver().parseBuildOutputTimestamp(outputTimestamp);
if (lastModified.isPresent()) {
zipArchiver.configureReproducibleBuild(FileTime.from(lastModified.get()));
}

File resultArchive = getArchiveFile(outputDirectory, finalName, getClassifier(), "zip");
Expand Down

0 comments on commit 20e27e3

Please sign in to comment.