This is an automated email from the ASF dual-hosted git repository. sjaranowski pushed a commit to branch MRRESOURCES-139 in repository https://gitbox.apache.org/repos/asf/maven-remote-resources-plugin.git
commit 1193d5d4842ec2e15dab74e217572e5bd12ad4cd Author: Slawomir Jaranowski <s.jaranow...@gmail.com> AuthorDate: Tue Sep 12 00:31:41 2023 +0200 [MRRESOURCES-139] Bump Bump maven-archiver from 3.6.0 to 3.6.1 Avoid using deprecated methods --- pom.xml | 2 +- .../remote/AbstractProcessRemoteResourcesMojo.java | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/pom.xml b/pom.xml index 84aa9fa..38f4be7 100644 --- a/pom.xml +++ b/pom.xml @@ -138,7 +138,7 @@ under the License. <dependency> <groupId>org.apache.maven</groupId> <artifactId>maven-archiver</artifactId> - <version>3.6.0</version> + <version>3.6.1</version> </dependency> <dependency> <groupId>org.apache.maven.shared</groupId> diff --git a/src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java b/src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java index 6a93aca..d569342 100644 --- a/src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java +++ b/src/main/java/org/apache/maven/plugin/resources/remote/AbstractProcessRemoteResourcesMojo.java @@ -35,12 +35,13 @@ import java.io.Writer; import java.net.MalformedURLException; import java.net.URL; import java.nio.file.Files; -import java.text.SimpleDateFormat; +import java.time.Instant; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; import java.util.AbstractMap; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; -import java.util.Date; import java.util.Enumeration; import java.util.HashMap; import java.util.LinkedHashSet; @@ -48,7 +49,6 @@ import java.util.List; import java.util.Map; import java.util.Properties; import java.util.Set; -import java.util.TimeZone; import java.util.TreeMap; import org.apache.commons.io.output.DeferredFileOutputStream; @@ -800,14 +800,13 @@ public abstract class AbstractProcessRemoteResourcesMojo extends AbstractMojo { context.put(KEY_PROJECTS_ORGS, null); // the following properties are cheap to calculate, so we provide them eagerly - // Reproducible Builds: try to use reproducible output timestamp - MavenArchiver archiver = new MavenArchiver(); - Date outputDate = archiver.parseOutputTimestamp(outputTimestamp); - String inceptionYear = project.getInceptionYear(); - SimpleDateFormat yearFormat = new SimpleDateFormat("yyyy"); - yearFormat.setTimeZone(TimeZone.getTimeZone("UTC")); - String year = yearFormat.format((outputDate == null) ? new Date() : outputDate); + + // Reproducible Builds: try to use reproducible output timestamp + String year = MavenArchiver.parseBuildOutputTimestamp(outputTimestamp) + .orElseGet(Instant::now) + .atZone(ZoneId.of("UTC+10")) + .format(DateTimeFormatter.ofPattern("yyyy")); if (inceptionYear == null || inceptionYear.isEmpty()) { if (getLog().isDebugEnabled()) {