You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by vs...@apache.org on 2008/08/29 14:24:18 UTC

svn commit: r690204 - /maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java

Author: vsiveton
Date: Fri Aug 29 05:24:18 2008
New Revision: 690204

URL: http://svn.apache.org/viewvc?rev=690204&view=rev
Log:
MPH-51: "help:help -Ddetail" looks better than "help:describe -Dplugin=help -Dfull"

o ordering mojo descriptors and parameters

Modified:
    maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java

Modified: maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java?rev=690204&r1=690203&r2=690204&view=diff
==============================================================================
--- maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java (original)
+++ maven/plugins/trunk/maven-help-plugin/src/main/java/org/apache/maven/plugins/help/DescribeMojo.java Fri Aug 29 05:24:18 2008
@@ -22,6 +22,8 @@
 import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.Iterator;
 import java.util.List;
 import java.util.StringTokenizer;
@@ -530,7 +532,21 @@
             append( buffer, "This plugin has " + pd.getMojos().size() + " goals:", 0 );
             buffer.append( "\n" );
 
-            for ( Iterator it = pd.getMojos().iterator(); it.hasNext(); )
+            List mojos = pd.getMojos();
+
+            Collections.sort( mojos, new Comparator()
+            {
+                /** {@inheritDoc} */
+                public int compare( Object o1, Object o2 )
+                {
+                    MojoDescriptor md1 = (MojoDescriptor) o1;
+                    MojoDescriptor md2 = (MojoDescriptor) o2;
+
+                    return md1.getId().compareTo( md2.getId() );
+                }
+            } );
+
+            for ( Iterator it = mojos.iterator(); it.hasNext(); )
             {
                 MojoDescriptor md = (MojoDescriptor) it.next();
 
@@ -703,6 +719,18 @@
     {
         List params = md.getParameters();
 
+        Collections.sort( params, new Comparator()
+        {
+            /** {@inheritDoc} */
+            public int compare( Object o1, Object o2 )
+            {
+                Parameter parameter1 = (Parameter) o1;
+                Parameter parameter2 = (Parameter) o2;
+
+                return parameter1.getName().compareTo( parameter2.getName() );
+            }
+        } );
+
         if ( params == null || params.isEmpty() )
         {
             append( buffer, "This mojo doesn't use any parameters.", 1 );