MJAR-263 make output jars reproducible like m-source-p
diff --git a/pom.xml b/pom.xml
index 9c05f0b..dbb1d33 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@
</parent>
<artifactId>maven-jar-plugin</artifactId>
- <version>3.1.3-SNAPSHOT</version>
+ <version>3.2.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<name>Apache Maven JAR Plugin</name>
@@ -76,7 +76,7 @@
<properties>
<mavenFileManagementVersion>3.0.0</mavenFileManagementVersion>
- <mavenArchiverVersion>3.4.0</mavenArchiverVersion>
+ <mavenArchiverVersion>3.5.0</mavenArchiverVersion>
<mavenVersion>3.0</mavenVersion>
<javaVersion>7</javaVersion>
</properties>
@@ -133,13 +133,13 @@
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-archiver</artifactId>
- <version>4.1.0</version>
+ <version>4.2.1</version>
</dependency>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-utils</artifactId>
- <version>3.2.0</version>
- </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-utils</artifactId>
+ <version>3.3.0</version>
+ </dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -199,7 +199,6 @@
<goal>clean</goal>
<goal>package</goal>
</goals>
- <streamLogs>true</streamLogs>
<showErrors>true</showErrors>
</configuration>
<executions>
diff --git a/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java b/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java
index 2763350..68da0ec 100644
--- a/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/jar/AbstractJarMojo.java
@@ -141,6 +141,16 @@
private boolean skipIfEmpty;
/**
+ * Timestamp for reproducible output archive entries, either formatted as ISO 8601
+ * <code>yyyy-MM-dd'T'HH:mm:ssXXX</code> or as an int representing seconds since the epoch (like
+ * <a href="https://reproducible-builds.org/docs/source-date-epoch/">SOURCE_DATE_EPOCH</a>).
+ *
+ * @since 3.2.0
+ */
+ @Parameter( defaultValue = "${project.build.outputTimestamp}" )
+ private String outputTimestamp;
+
+ /**
* Return the specific output directory to serve as the root for the archive.
* @return get classes directory.
*/
@@ -233,6 +243,7 @@
}
MavenArchiver archiver = new MavenArchiver();
+ archiver.setCreatedBy( "Maven Jar Plugin", "org.apache.maven.plugins", "maven-jar-plugin" );
if ( containsModuleDescriptor )
{
@@ -245,6 +256,9 @@
archiver.setOutputFile( jarFile );
+ // configure for Reproducible Builds based on outputTimestamp value
+ archiver.configureReproducible( outputTimestamp );
+
archive.setForced( forceCreation );
try