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 15:20:49 UTC

[maven-ear-plugin] branch master updated: [MEAR-280] support Reproducible ear 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-ear-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 4cb6de0  [MEAR-280] support Reproducible ear creation based on outputTimestamp
4cb6de0 is described below

commit 4cb6de075df98fead324d4bf63c7189ead166e5c
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Sun May 10 17:20:44 2020 +0200

    [MEAR-280] support Reproducible ear creation based on outputTimestamp
---
 pom.xml                                                | 18 +++++-------------
 src/it/basic/pom.xml                                   |  4 ++++
 .../java/org/apache/maven/plugins/ear/EarMojo.java     | 15 +++++++++++++++
 3 files changed, 24 insertions(+), 13 deletions(-)

diff --git a/pom.xml b/pom.xml
index 259482b..caac3c0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,7 +30,7 @@
   </parent>
 
   <artifactId>maven-ear-plugin</artifactId>
-  <version>3.0.3-SNAPSHOT</version>
+  <version>3.1.0-SNAPSHOT</version>
   <packaging>maven-plugin</packaging>
 
   <name>Apache Maven EAR Plugin</name>
@@ -80,7 +80,7 @@
   </contributors>
 
   <properties>
-    <mavenArchiverVersion>3.2.0</mavenArchiverVersion>
+    <mavenArchiverVersion>3.5.0</mavenArchiverVersion>
     <mavenFilteringVersion>3.1.1</mavenFilteringVersion>
     <mavenVersion>3.0</mavenVersion>
     <javaVersion>7</javaVersion>
@@ -117,12 +117,12 @@
     <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.1.0</version>
+      <version>3.3.0</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven.shared</groupId>
@@ -170,14 +170,6 @@
 
     <pluginManagement>
       <plugins>
-        <!--
-          TODO: maven-invoker-plugin version should come from maven-plugins pom
-        -->
-        <plugin>
-          <groupId>org.apache.maven.plugins</groupId>
-          <artifactId>maven-invoker-plugin</artifactId>
-          <version>3.2.1</version>
-        </plugin>
         <plugin>
           <groupId>org.apache.rat</groupId>
           <artifactId>apache-rat-plugin</artifactId>
@@ -265,7 +257,7 @@
             <groupId>org.apache.maven.plugins</groupId>
             <artifactId>maven-invoker-plugin</artifactId>
             <configuration>
-              <streamLogs>true</streamLogs>
+              <streamLogs>false</streamLogs>
               <!-- NOTE: Must be synced with the repo path used by AbstractEarPluginIT -->
               <localRepositoryPath>${localRepositoryPath}</localRepositoryPath>
               <goals>
diff --git a/src/it/basic/pom.xml b/src/it/basic/pom.xml
index cb4f225..9104f35 100644
--- a/src/it/basic/pom.xml
+++ b/src/it/basic/pom.xml
@@ -30,6 +30,10 @@ under the License.
   <name>Maven Integration Test :: it0033</name> 
   <description>Test an EAR generation</description>
 
+  <properties>
+    <project.build.outputTimestamp>2020-05-01T12:12:12Z</project.build.outputTimestamp>
+  </properties>
+
   <build>
     <plugins>
       <plugin>
diff --git a/src/main/java/org/apache/maven/plugins/ear/EarMojo.java b/src/main/java/org/apache/maven/plugins/ear/EarMojo.java
index c29d938..b22cb5f 100644
--- a/src/main/java/org/apache/maven/plugins/ear/EarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/ear/EarMojo.java
@@ -224,6 +224,16 @@ public class EarMojo
     private MavenArchiveConfiguration archive = new MavenArchiveConfiguration();
 
     /**
+     * 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.1.0
+     */
+    @Parameter( defaultValue = "${project.build.outputTimestamp}" )
+    private String outputTimestamp;
+
+    /**
      */
     @Component
     private MavenProjectHelper projectHelper;
@@ -327,6 +337,11 @@ public class EarMojo
             archiver.setArchiver( theJarArchiver );
             archiver.setOutputFile( earFile );
 
+            archiver.setCreatedBy( "Maven EAR Plugin", "org.apache.maven.plugins", "maven-ear-plugin" );
+
+            // configure for Reproducible Builds based on outputTimestamp value
+            archiver.configureReproducible( outputTimestamp );
+
             getLog().debug( "Excluding " + Arrays.asList( getPackagingExcludes() ) + " from the generated EAR." );
             getLog().debug( "Including " + Arrays.asList( getPackagingIncludes() ) + " in the generated EAR." );