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-archiver.git
The following commit(s) were added to refs/heads/master by this push:
new 763a940 [MSHARED-833] make pom.properties entries order reproducible
763a940 is described below
commit 763a940540eefad74f9ba73cb5eed288dc4e639d
Author: Hervé Boutemy <[email protected]>
AuthorDate: Fri Aug 30 08:23:43 2019 +0200
[MSHARED-833] make pom.properties entries order reproducible
---
.../org/apache/maven/archiver/PomPropertiesUtil.java | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java
b/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java
index 5f20756..9fac0f7 100644
--- a/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java
+++ b/src/main/java/org/apache/maven/archiver/PomPropertiesUtil.java
@@ -27,6 +27,9 @@ import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringReader;
import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
import java.util.Properties;
import org.apache.maven.execution.MavenSession;
@@ -35,7 +38,8 @@ import org.apache.maven.shared.utils.io.IOUtil;
import org.codehaus.plexus.archiver.Archiver;
/**
- * This class is responsible for creating the pom.properties file.
+ * This class is responsible for creating the <code>pom.properties</code> file
+ * in <code>META-INF/maven/${groupId}/${artifactId}</code>.
*/
public class PomPropertiesUtil
{
@@ -91,12 +95,13 @@ public class PomPropertiesUtil
BufferedReader r = new BufferedReader( new StringReader(
sw.toString() ) );
+ List<String> lines = new ArrayList<String>();
String line;
while ( ( line = r.readLine() ) != null )
{
if ( !line.startsWith( "#" ) )
{
- pw.println( line );
+ lines.add( line );
}
}
@@ -104,6 +109,13 @@ public class PomPropertiesUtil
r = null;
sw.close();
sw = null;
+
+ Collections.sort( lines );
+ for ( String l : lines )
+ {
+ pw.println( l );
+ }
+
pw.close();
pw = null;
}