Skip to content
Merged
Show file tree
Hide file tree
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
8 changes: 8 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ jobs:
build:
name: Build it
uses: codehaus-plexus/.github/.github/workflows/maven.yml@master
with:
# Execute on a jdk between 17 and 17.0.2 to explicitly test workaround for jar tool --date support not present in that version
# See org.codehaus.plexus.archiver.jar.JarToolModularJarArchiver.isJarDateOptionSupported
# https://github.com/codehaus-plexus/plexus-archiver/issues/164
matrix-include: >
[
{"jdk": "17.0.2", "os": "windows-latest", distribution: "zulu" }
]

# deploy:
# name: Deploy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,14 @@ protected void postCreateArchive() throws ArchiverException {
private void fixLastModifiedTimeZipEntries() throws IOException {
long timeMillis = getLastModifiedTime().toMillis();
Path destFile = getDestFile().toPath();
PosixFileAttributes posixFileAttributes = Files.getFileAttributeView(
destFile, PosixFileAttributeView.class, LinkOption.NOFOLLOW_LINKS)
.readAttributes();
PosixFileAttributeView view =
Files.getFileAttributeView(destFile, PosixFileAttributeView.class, LinkOption.NOFOLLOW_LINKS);

PosixFileAttributes posixFileAttributes = null;
if (view != null) {
posixFileAttributes = view.readAttributes();
}

FileAttribute<?>[] attributes;
if (posixFileAttributes != null) {
attributes = new FileAttribute<?>[1];
Expand Down Expand Up @@ -272,7 +277,7 @@ private static FileTime revertToLocalTime(FileTime time) {
}

/**
* Check support for {@code --date} option introduced since Java 17.0.3 (JDK-8279925).
* Check support for {@code --date} option introduced since Java 17.0.3 with <a href="https://bugs.openjdk.org/browse/JDK-8277755">JDK-8277755</a>.
*
* @return true if the JAR tool supports the {@code --date} option
*/
Expand Down