From 497f80f40308ba40a30b129f44f5d537fccbb322 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jorge=20Sol=C3=B3rzano?= Date: Tue, 28 Jun 2022 17:41:18 +0200 Subject: [PATCH] [MJAVADOC-719] - Update Maven Archiver to 3.6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Jorge Solórzano --- pom.xml | 14 ++--------- .../plugins/javadoc/AbstractJavadocMojo.java | 24 +++++++++++-------- .../maven/plugins/javadoc/JavadocJar.java | 2 +- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/pom.xml b/pom.xml index 9485119d3..cc763f61c 100644 --- a/pom.xml +++ b/pom.xml @@ -212,7 +212,7 @@ under the License. org.apache.maven maven-archiver - 3.5.2 + 3.6.0 org.apache.maven.shared @@ -285,20 +285,10 @@ under the License. plexus-java ${plexus-java.version} - - org.codehaus.plexus - plexus-archiver - 4.2.7 - - - org.codehaus.plexus - plexus-io - 3.2.0 - org.codehaus.plexus plexus-utils - 3.3.0 + 3.4.2 commons-io diff --git a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java index a26d19cd5..71c78919f 100644 --- a/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java +++ b/src/main/java/org/apache/maven/plugins/javadoc/AbstractJavadocMojo.java @@ -119,12 +119,12 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardCopyOption; +import java.time.LocalDate; +import java.time.ZoneOffset; import java.util.ArrayList; import java.util.Arrays; -import java.util.Calendar; import java.util.Collection; import java.util.Collections; -import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.LinkedHashMap; @@ -3037,14 +3037,12 @@ private String getBottomText() { final String inceptionYear = project.getInceptionYear(); - // get Reproducible Builds outputTimestamp value - final Calendar currentYearCal = Calendar.getInstance(); - final Date reproducibleDate = new MavenArchiver().parseOutputTimestamp( outputTimestamp ); - if ( reproducibleDate != null ) - { - currentYearCal.setTime( reproducibleDate ); - } - final String currentYear = String.valueOf( currentYearCal.get( Calendar.YEAR ) ); + // get Reproducible Builds outputTimestamp date value or the current local date. + final LocalDate localDate = MavenArchiver.parseBuildOutputTimestamp( outputTimestamp ) + .map( instant -> instant.atZone( ZoneOffset.UTC ).toLocalDate() ) + .orElseGet( LocalDate::now ); + + final String currentYear = Integer.toString( localDate.getYear() ); String theBottom = StringUtils.replace( this.bottom, "{currentYear}", currentYear ); @@ -5656,6 +5654,12 @@ private void addStandardDocletOptions( File javadocOutputDirectory, addArgIf( arguments, nosince, "-nosince" ); + if ( MavenArchiver.parseBuildOutputTimestamp( outputTimestamp ).isPresent() ) + { + // Override the notimestamp option if a Reproducible Build is requested. + notimestamp = true; + } + addArgIf( arguments, notimestamp, "-notimestamp", SINCE_JAVADOC_1_5 ); addArgIf( arguments, notree, "-notree" ); diff --git a/src/main/java/org/apache/maven/plugins/javadoc/JavadocJar.java b/src/main/java/org/apache/maven/plugins/javadoc/JavadocJar.java index d2c764ba6..2a20bb8c2 100644 --- a/src/main/java/org/apache/maven/plugins/javadoc/JavadocJar.java +++ b/src/main/java/org/apache/maven/plugins/javadoc/JavadocJar.java @@ -270,7 +270,7 @@ private File generateArchive( File javadocFiles, String jarFileName ) archiver.setOutputFile( javadocJar ); // configure for Reproducible Builds based on outputTimestamp value - archiver.configureReproducible( outputTimestamp ); + archiver.configureReproducibleBuild( outputTimestamp ); if ( !javadocFiles.exists() ) {