directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r639693 - /directory/studio/trunk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java
Date Fri, 21 Mar 2008 16:14:36 GMT
Author: pamarcelot
Date: Fri Mar 21 09:14:17 2008
New Revision: 639693

URL: http://svn.apache.org/viewvc?rev=639693&view=rev
Log:
Updated the Studio Maven Plugin to sort Artifacts using their artifact ids to avoid the problem
with updated MANIFEST.MF files.

Modified:
    directory/studio/trunk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java

Modified: directory/studio/trunk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java?rev=639693&r1=639692&r2=639693&view=diff
==============================================================================
--- directory/studio/trunk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java
(original)
+++ directory/studio/trunk/studio-plugin/src/main/java/org/apache/directory/studio/maven/plugins/AbstractStudioMojo.java
Fri Mar 21 09:14:17 2008
@@ -23,6 +23,8 @@
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.Iterator;
 import java.util.List;
 
@@ -413,6 +415,8 @@
     protected List<Artifact> createArtifactList()
     {
         List<Artifact> list = new ArrayList<Artifact>();
+        
+        // Copying only artifacts with 'provided' scope
         for ( Iterator<Artifact> artifactItem = project.getArtifacts().iterator();
artifactItem.hasNext(); )
         {
             Artifact artifact = ( Artifact ) artifactItem.next();
@@ -421,6 +425,25 @@
                 list.add( artifact );
             }
         }
+
+        // Sorting list before returning it
+        Collections.sort( list, new Comparator<Artifact>()
+        {
+            public int compare( Artifact o1, Artifact o2 )
+            {
+                String artifactId1 = o1.getArtifactId();
+                String artifactId2 = o2.getArtifactId();
+
+                if ( ( artifactId1 != null ) && ( artifactId2 != null ) )
+                {
+                    return artifactId1.compareToIgnoreCase( artifactId2 );
+                }
+
+                // Default
+                return o1.toString().compareToIgnoreCase( o2.toString() );
+            }
+        } );
+        
         return list;
     }
 



Mime
View raw message