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 2019/08/25 21:18:17 UTC

[maven-source-plugin] branch MSOURCES-120 updated: MSOURCES-120 sort archive entries

This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to branch MSOURCES-120
in repository https://gitbox.apache.org/repos/asf/maven-source-plugin.git


The following commit(s) were added to refs/heads/MSOURCES-120 by this push:
     new 28118a0  MSOURCES-120 sort archive entries
28118a0 is described below

commit 28118a05faf877628b31df3375449cdb15d68c95
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Sun Aug 25 23:18:13 2019 +0200

    MSOURCES-120 sort archive entries
    
    and remove Build-Jdk-Spec entry from MANIFEST.MF
---
 pom.xml                                                          | 5 +++++
 src/it/reproducible/pom.xml                                      | 5 +++++
 src/it/reproducible/verify.groovy                                | 2 +-
 .../org/apache/maven/plugins/source/AbstractSourceJarMojo.java   | 9 +++++++++
 4 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index d279964..1ec164e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -118,6 +118,11 @@ under the License.
       <version>4.2.0-SNAPSHOT</version>
     </dependency>
     <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>3.3.0-SNAPSHOT</version>
+    </dependency>
+    <dependency>
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-compress</artifactId>
       <version>1.19-SNAPSHOT</version>
diff --git a/src/it/reproducible/pom.xml b/src/it/reproducible/pom.xml
index 13a6af9..76ca699 100644
--- a/src/it/reproducible/pom.xml
+++ b/src/it/reproducible/pom.xml
@@ -41,6 +41,11 @@
         <version>@project.version@</version>
         <configuration>
           <source-date-epoch>1566419331</source-date-epoch>
+          <archive>
+            <manifest>
+              <addDefaultEntries>false</addDefaultEntries>
+            </manifest>
+          </archive>
         </configuration>
       </plugin>
       <plugin>
diff --git a/src/it/reproducible/verify.groovy b/src/it/reproducible/verify.groovy
index f211d59..5992bdf 100644
--- a/src/it/reproducible/verify.groovy
+++ b/src/it/reproducible/verify.groovy
@@ -30,4 +30,4 @@ String sha1 = sha1File.text
 
 println( "reproducible-1.0-sources.jar sha1 = $sha1" )
 
-assert sha1 == '77f410a2606f3e57e6195fb69164da59faa7af31'
+assert sha1 == '9173271b3c31dac61b1501479ad2bea35af33566'
diff --git a/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java b/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
index 976195e..2300882 100644
--- a/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
+++ b/src/main/java/org/apache/maven/plugins/source/AbstractSourceJarMojo.java
@@ -23,6 +23,7 @@ import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Comparator;
 import java.util.Date;
 import java.util.List;
 
@@ -283,6 +284,14 @@ public abstract class AbstractSourceJarMojo
         if ( sourceDateEpoch != 0 )
         {
             archiver.getArchiver().setLastModifiedDate( new Date( 1000L * sourceDateEpoch ) );
+            archiver.getArchiver().setFilenameComparator( new Comparator<String>()
+            {
+                @Override
+                public int compare( String s1, String s2 )
+                {
+                    return s1.compareTo( s2 );
+                }
+            } );
         }
 
         for ( MavenProject pItem : theProjects )