Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace two deprecated methods #224

Merged
merged 3 commits into from
Dec 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -41,10 +41,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 @@ -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
*/
Expand Down Expand Up @@ -491,8 +492,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 @@ -576,9 +577,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 = MavenArchiver.parseBuildOutputTimestamp(outputTimestamp);
if (lastModified.isPresent()) {
zipArchiver.configureReproducibleBuild(FileTime.from(lastModified.get()));
}

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