This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-jar-plugin.git
commit 8853cb03829de2224827f874a95037b00383e8c3 Author: Sylwester Lachiewicz <[email protected]> AuthorDate: Thu Nov 5 01:36:13 2026 +0000 Import Arrays and document the stale jar assumption in the jar tests --- .../java/org/apache/maven/plugins/jar/JarDefaultExcludesTest.java | 3 ++- src/test/java/org/apache/maven/plugins/jar/JarRecreationTest.java | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/test/java/org/apache/maven/plugins/jar/JarDefaultExcludesTest.java b/src/test/java/org/apache/maven/plugins/jar/JarDefaultExcludesTest.java index ae74636..dcd1cb5 100644 --- a/src/test/java/org/apache/maven/plugins/jar/JarDefaultExcludesTest.java +++ b/src/test/java/org/apache/maven/plugins/jar/JarDefaultExcludesTest.java @@ -23,6 +23,7 @@ import javax.inject.Inject; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; +import java.util.Arrays; import java.util.Enumeration; import java.util.HashSet; import java.util.Set; @@ -126,7 +127,7 @@ class JarDefaultExcludesTest { /** The entries that the default excludes are meant to drop. */ private static Set<String> ignoredFiles(Set<String> entries) { Set<String> ignored = new HashSet<>(entries); - ignored.retainAll(new HashSet<>(java.util.Arrays.asList(".DS_Store", ".svn/entries", "Foo.java~"))); + ignored.retainAll(new HashSet<>(Arrays.asList(".DS_Store", ".svn/entries", "Foo.java~"))); return ignored; } } diff --git a/src/test/java/org/apache/maven/plugins/jar/JarRecreationTest.java b/src/test/java/org/apache/maven/plugins/jar/JarRecreationTest.java index f046605..b5bca5a 100644 --- a/src/test/java/org/apache/maven/plugins/jar/JarRecreationTest.java +++ b/src/test/java/org/apache/maven/plugins/jar/JarRecreationTest.java @@ -93,7 +93,11 @@ class JarRecreationTest { assertArrayEquals(STALE, Files.readAllBytes(jar), "the up to date jar was rewritten"); } - /** Runs the mojo, replaces the jar with stale bytes dated ahead of its sources, runs the mojo again. */ + /** + * Runs the mojo, replaces the jar with stale bytes dated ahead of its sources, runs the mojo again. The stale + * bytes are not a valid archive: the kept case relies on the archiver deciding from the timestamps alone, + * without opening the existing jar. An archiver that validates the file first would fail it instead. + */ private Path packageOverStaleJar(JarMojo mojo) throws Exception { project.setGroupId("org.apache.maven.plugins"); project.setArtifactId("recreation");
