You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2020/05/10 17:51:21 UTC
[maven-acr-plugin] branch master updated: [MACR-53] support
Reproducible jar creation based on outputTimestamp
This is an automated email from the ASF dual-hosted git repository.
hboutemy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-acr-plugin.git
The following commit(s) were added to refs/heads/master by this push:
new 8a66ae2 [MACR-53] support Reproducible jar creation based on outputTimestamp
8a66ae2 is described below
commit 8a66ae20fbab42a47d2c75206743fe3f90084fb4
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Sun May 10 19:51:17 2020 +0200
[MACR-53] support Reproducible jar creation based on outputTimestamp
---
pom.xml | 2 +-
src/it/it-01/pom.xml | 1 +
.../java/org/apache/maven/plugins/acr/AcrMojo.java | 23 +++++++++++++++++-----
3 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/pom.xml b/pom.xml
index 81d53ae..ee0e5fd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@ under the License.
</parent>
<artifactId>maven-acr-plugin</artifactId>
- <version>3.1.1-SNAPSHOT</version>
+ <version>3.2.0-SNAPSHOT</version>
<packaging>maven-plugin</packaging>
<name>Apache Maven ACR Plugin</name>
diff --git a/src/it/it-01/pom.xml b/src/it/it-01/pom.xml
index 5b5c798..0466b27 100644
--- a/src/it/it-01/pom.xml
+++ b/src/it/it-01/pom.xml
@@ -32,6 +32,7 @@ under the License.
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <project.build.outputTimestamp>2020-05-01T12:12:12Z</project.build.outputTimestamp>
</properties>
<build>
diff --git a/src/main/java/org/apache/maven/plugins/acr/AcrMojo.java b/src/main/java/org/apache/maven/plugins/acr/AcrMojo.java
index f104492..7bdd8d9 100644
--- a/src/main/java/org/apache/maven/plugins/acr/AcrMojo.java
+++ b/src/main/java/org/apache/maven/plugins/acr/AcrMojo.java
@@ -52,11 +52,9 @@ import org.codehaus.plexus.util.FileUtils;
*
* @author <a href="pablo@anahata-it.com">Pablo Rodriguez</a>
* @author <a href="snicoll@apache.org">Stephane Nicoll</a>
- * @version $Id:
*/
-// CHECKSTYLE_OFF: LineLength
-@Mojo( name = "acr", requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true, defaultPhase = LifecyclePhase.PACKAGE )
-// CHECKSTYLE_ON: LineLength
+@Mojo( name = "acr", requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true,
+ defaultPhase = LifecyclePhase.PACKAGE )
public class AcrMojo
extends AbstractMojo
{
@@ -117,7 +115,7 @@ public class AcrMojo
private JarArchiver jarArchiver;
/**
- * The archive configuration to use. See <a href="http://maven.apache.org/shared/maven-archiver/index.html">Maven
+ * The archive configuration to use. See <a href="https://maven.apache.org/shared/maven-archiver/index.html">Maven
* Archiver Reference</a>.
*/
@Parameter
@@ -162,6 +160,16 @@ public class AcrMojo
@Parameter( defaultValue = "${session}", readonly = true, required = true )
private MavenSession session;
+ /**
+ * 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;
+
/** {@inheritDoc} */
public void execute()
throws MojoExecutionException
@@ -178,8 +186,13 @@ public class AcrMojo
archiver.setArchiver( jarArchiver );
+ archiver.setCreatedBy( "Maven ACR Plugin", "org.apache.maven.plugins", "maven-acr-plugin" );
+
archiver.setOutputFile( jarFile );
+ // configure for Reproducible Builds based on outputTimestamp value
+ archiver.configureReproducible( outputTimestamp );
+
try
{
String[] mainJarExcludes = DEFAULT_EXCLUDES;