You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2009/06/17 08:06:17 UTC

svn commit: r785480 - /geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/DependencyChangeMojo.java

Author: djencks
Date: Wed Jun 17 06:06:16 2009
New Revision: 785480

URL: http://svn.apache.org/viewvc?rev=785480&view=rev
Log:
GERONIMO-4692 step 1, update car-maven-plugin to sort dependencies.xml

Modified:
    geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/DependencyChangeMojo.java

Modified: geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/DependencyChangeMojo.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/DependencyChangeMojo.java?rev=785480&r1=785479&r2=785480&view=diff
==============================================================================
--- geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/DependencyChangeMojo.java (original)
+++ geronimo/server/trunk/framework/buildsupport/car-maven-plugin/src/main/java/org/apache/geronimo/mavenplugins/car/DependencyChangeMojo.java Wed Jun 17 06:06:16 2009
@@ -32,6 +32,7 @@
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
+import java.util.Comparator;
 
 import javax.xml.bind.JAXBException;
 import javax.xml.stream.XMLStreamException;
@@ -156,7 +157,7 @@
     }
 
     protected File saveTreeListing() throws IOException {
-        File treeListFile = new File(dependencyFile.getParentFile(), "treeListing.xml");
+        File treeListFile = new File(dependencyFile.getParentFile(), "treeListing.txt");
         OutputStream os = new FileOutputStream(treeListFile);
         BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(os));
         try {
@@ -184,6 +185,20 @@
             throw new IOException("expected dependencies history directory is not a directory: " + parent);
         }
         FileWriter out = new FileWriter(file);
+        Collections.sort(pluginArtifactType.getDependency(), new Comparator<DependencyType>() {
+
+            public int compare(DependencyType a, DependencyType b) {
+                int result = a.getGroupId().compareTo(b.getGroupId());
+                if (result != 0) return result;
+                result = a.getArtifactId().compareTo(b.getArtifactId());
+                if (result != 0) return result;
+                return getType(a).compareTo(getType(b));
+            }
+
+            private String getType(DependencyType a) {
+                return a.getType() == null? "jar": a.getType();
+            }
+        });
         try {
             PluginXmlUtil.writePluginArtifact(pluginArtifactType, out);
         } finally {