This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch maven-archiver-3.x in repository https://gitbox.apache.org/repos/asf/maven-archiver.git
The following commit(s) were added to refs/heads/maven-archiver-3.x by this push: new 53dd283 [MSHARED-1421] Bump org.codehaus.plexus:plexus-archiver from 4.9.2 to 4.10.0 (#66) 53dd283 is described below commit 53dd2835733a7d4491f582ea2d6010ef7260f793 Author: Sylwester Lachiewicz <slachiew...@apache.org> AuthorDate: Mon Jul 8 22:12:02 2024 +0200 [MSHARED-1421] Bump org.codehaus.plexus:plexus-archiver from 4.9.2 to 4.10.0 (#66) --- pom.xml | 11 +++- .../org/apache/maven/archiver/MavenArchiver.java | 14 ----- .../archiver/MavenArchiveConfigurationTest.java | 1 - .../apache/maven/archiver/MavenArchiverTest.java | 59 +++++++++++----------- 4 files changed, 38 insertions(+), 47 deletions(-) diff --git a/pom.xml b/pom.xml index 24a38c5..629e765 100644 --- a/pom.xml +++ b/pom.xml @@ -55,7 +55,7 @@ </distributionManagement> <properties> - <mavenVersion>3.2.5</mavenVersion> + <mavenVersion>3.6.3</mavenVersion> <javaVersion>8</javaVersion> <project.build.outputTimestamp>2024-03-24T22:30:56Z</project.build.outputTimestamp> </properties> @@ -88,7 +88,7 @@ <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-archiver</artifactId> - <version>4.9.2</version> + <version>4.10.0</version> </dependency> <dependency> <groupId>org.codehaus.plexus</groupId> @@ -127,4 +127,11 @@ <scope>test</scope> </dependency> </dependencies> + <repositories> + <repository> + <id>maven_central</id> + <name>Maven Central</name> + <url>https://repo.maven.apache.org/maven2/</url> + </repository> + </repositories> </project> diff --git a/src/main/java/org/apache/maven/archiver/MavenArchiver.java b/src/main/java/org/apache/maven/archiver/MavenArchiver.java index ad1e0db..5b3e2f7 100644 --- a/src/main/java/org/apache/maven/archiver/MavenArchiver.java +++ b/src/main/java/org/apache/maven/archiver/MavenArchiver.java @@ -584,24 +584,10 @@ public class MavenArchiver { // Configure the jar archiver.addConfiguredManifest(manifest); - archiver.setCompress(archiveConfiguration.isCompress()); - archiver.setRecompressAddedZips(archiveConfiguration.isRecompressAddedZips()); - - archiver.setIndex(archiveConfiguration.isIndex()); - archiver.setDestFile(archiveFile); - // make the archiver index the jars on the classpath, if we are adding that to the manifest - if (archiveConfiguration.getManifest().isAddClasspath()) { - List<String> artifacts = project.getRuntimeClasspathElements(); - for (String artifact : artifacts) { - File f = new File(artifact); - archiver.addConfiguredIndexJars(f); - } - } - archiver.setForced(forced); if (!archiveConfiguration.isForced() && archiver.isSupportingForced()) { // TODO Should issue a warning here, but how do we get a logger? diff --git a/src/test/java/org/apache/maven/archiver/MavenArchiveConfigurationTest.java b/src/test/java/org/apache/maven/archiver/MavenArchiveConfigurationTest.java index 1756c03..994a4c7 100644 --- a/src/test/java/org/apache/maven/archiver/MavenArchiveConfigurationTest.java +++ b/src/test/java/org/apache/maven/archiver/MavenArchiveConfigurationTest.java @@ -39,7 +39,6 @@ class MavenArchiveConfigurationTest { archive.setManifest(new ManifestConfiguration()); archive.setForced(false); archive.setCompress(false); - archive.setIndex(false); } @Test diff --git a/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java b/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java index 6c74558..97850c5 100644 --- a/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java +++ b/src/test/java/org/apache/maven/archiver/MavenArchiverTest.java @@ -65,6 +65,7 @@ import org.junit.jupiter.params.provider.EmptySource; import org.junit.jupiter.params.provider.NullAndEmptySource; import org.junit.jupiter.params.provider.ValueSource; +import static org.apache.maven.archiver.MavenArchiver.parseBuildOutputTimestamp; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatExceptionOfType; @@ -1168,7 +1169,6 @@ class MavenArchiverTest { model.setVersion("0.1.1"); final MavenProject project = new MavenProject(model); - project.setExtensionArtifacts(Collections.emptySet()); project.setRemoteArtifactRepositories(Collections.emptyList()); project.setPluginArtifactRepositories(Collections.emptyList()); project.setName("archiver test"); @@ -1330,37 +1330,36 @@ class MavenArchiverTest { @Test void testParseOutputTimestamp() { - MavenArchiver archiver = new MavenArchiver(); - - assertThat(archiver.parseOutputTimestamp(null)).isNull(); - assertThat(archiver.parseOutputTimestamp("")).isNull(); - assertThat(archiver.parseOutputTimestamp(".")).isNull(); - assertThat(archiver.parseOutputTimestamp(" ")).isNull(); - assertThat(archiver.parseOutputTimestamp("_")).isNull(); - assertThat(archiver.parseOutputTimestamp("-")).isNull(); - assertThat(archiver.parseOutputTimestamp("/")).isNull(); - assertThat(archiver.parseOutputTimestamp("!")).isNull(); - assertThat(archiver.parseOutputTimestamp("*")).isNull(); - - assertThat(archiver.parseOutputTimestamp("1570300662").getTime()).isEqualTo(1570300662000L); - assertThat(archiver.parseOutputTimestamp("0").getTime()).isZero(); - assertThat(archiver.parseOutputTimestamp("1").getTime()).isEqualTo(1000L); - - assertThat(archiver.parseOutputTimestamp("2019-10-05T18:37:42Z").getTime()) - .isEqualTo(1570300662000L); - assertThat(archiver.parseOutputTimestamp("2019-10-05T20:37:42+02:00").getTime()) - .isEqualTo(1570300662000L); - assertThat(archiver.parseOutputTimestamp("2019-10-05T16:37:42-02:00").getTime()) - .isEqualTo(1570300662000L); + assertThat(parseBuildOutputTimestamp(null)).isEmpty(); + assertThat(parseBuildOutputTimestamp("")).isEmpty(); + assertThat(parseBuildOutputTimestamp(".")).isEmpty(); + assertThat(parseBuildOutputTimestamp(" ")).isEmpty(); + assertThat(parseBuildOutputTimestamp("_")).isEmpty(); + assertThat(parseBuildOutputTimestamp("-")).isEmpty(); + assertThat(parseBuildOutputTimestamp("/")).isEmpty(); + assertThat(parseBuildOutputTimestamp("!")).isEmpty(); + assertThat(parseBuildOutputTimestamp("*")).isEmpty(); + + assertThat(parseBuildOutputTimestamp("1570300662").get().getEpochSecond()) + .isEqualTo(1570300662L); + assertThat(parseBuildOutputTimestamp("0").get().getEpochSecond()).isZero(); + assertThat(parseBuildOutputTimestamp("1").get().getEpochSecond()).isEqualTo(1L); + + assertThat(parseBuildOutputTimestamp("2019-10-05T18:37:42Z").get().getEpochSecond()) + .isEqualTo(1570300662L); + assertThat(parseBuildOutputTimestamp("2019-10-05T20:37:42+02:00").get().getEpochSecond()) + .isEqualTo(1570300662L); + assertThat(parseBuildOutputTimestamp("2019-10-05T16:37:42-02:00").get().getEpochSecond()) + .isEqualTo(1570300662L); // These must result in IAE because we expect extended ISO format only (ie with - separator for date and // : separator for timezone), hence the XXX SimpleDateFormat for tz offset // X SimpleDateFormat accepts timezone without separator while date has separator, which is a mix between // basic (no separators, both for date and timezone) and extended (separator for both) assertThatExceptionOfType(IllegalArgumentException.class) - .isThrownBy(() -> archiver.parseOutputTimestamp("2019-10-05T20:37:42+0200")); + .isThrownBy(() -> parseBuildOutputTimestamp("2019-10-05T20:37:42+0200")); assertThatExceptionOfType(IllegalArgumentException.class) - .isThrownBy(() -> archiver.parseOutputTimestamp("2019-10-05T20:37:42-0200")); + .isThrownBy(() -> parseBuildOutputTimestamp("2019-10-05T20:37:42-0200")); } @ParameterizedTest @@ -1368,7 +1367,7 @@ class MavenArchiverTest { @ValueSource(strings = {".", " ", "_", "-", "T", "/", "!", "!", "*", "ñ"}) void testEmptyParseOutputTimestampInstant(String value) { // Empty optional if null or 1 char - assertThat(MavenArchiver.parseBuildOutputTimestamp(value)).isEmpty(); + assertThat(parseBuildOutputTimestamp(value)).isEmpty(); } @ParameterizedTest @@ -1387,7 +1386,7 @@ class MavenArchiverTest { "2099-12-31T23:59:59Z,4102444799" }) void testParseOutputTimestampInstant(String value, long expected) { - assertThat(MavenArchiver.parseBuildOutputTimestamp(value)).contains(Instant.ofEpochSecond(expected)); + assertThat(parseBuildOutputTimestamp(value)).contains(Instant.ofEpochSecond(expected)); } @ParameterizedTest @@ -1404,7 +1403,7 @@ class MavenArchiverTest { void testThrownParseOutputTimestampInstant(String outputTimestamp) { // Invalid parsing assertThatExceptionOfType(IllegalArgumentException.class) - .isThrownBy(() -> MavenArchiver.parseBuildOutputTimestamp(outputTimestamp)) + .isThrownBy(() -> parseBuildOutputTimestamp(outputTimestamp)) .withCauseInstanceOf(DateTimeParseException.class); } @@ -1421,7 +1420,7 @@ class MavenArchiverTest { void testThrownParseOutputTimestampInvalidRange(String outputTimestamp) { // date is not within the valid range 1980-01-01T00:00:02Z to 2099-12-31T23:59:59Z assertThatExceptionOfType(IllegalArgumentException.class) - .isThrownBy(() -> MavenArchiver.parseBuildOutputTimestamp(outputTimestamp)) + .isThrownBy(() -> parseBuildOutputTimestamp(outputTimestamp)) .withMessageContaining("is not within the valid range 1980-01-01T00:00:02Z to 2099-12-31T23:59:59Z"); } @@ -1434,6 +1433,6 @@ class MavenArchiverTest { }) @EnabledForJreRange(min = JRE.JAVA_9) void testShortOffset(String value, long expected) { - assertThat(MavenArchiver.parseBuildOutputTimestamp(value)).contains(Instant.ofEpochSecond(expected)); + assertThat(parseBuildOutputTimestamp(value)).contains(Instant.ofEpochSecond(expected)); } }