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/30 00:11:31 UTC

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

Author: vsiveton
Date: Fri Aug 29 15:11:30 2008
New Revision: 690406

URL: http://svn.apache.org/viewvc?rev=690406&view=rev
Log:
o using PluginUtils#sortMojos()
o minor improvements

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=690406&r1=690405&r2=690406&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 15:11:30 2008
@@ -529,22 +529,13 @@
 
         if ( ( detail || medium ) && !minimal )
         {
-            append( buffer, "This plugin has " + pd.getMojos().size() + " goals:", 0 );
+            append( buffer, "This plugin has " + pd.getMojos().size() + " goal"
+                + ( pd.getMojos().size() > 1 ? "" : "s" ) + ":", 0 );
             buffer.append( "\n" );
 
             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() );
-                }
-            } );
+            PluginUtils.sortMojos( mojos );
 
             for ( Iterator it = mojos.iterator(); it.hasNext(); )
             {
@@ -719,6 +710,13 @@
     {
         List params = md.getParameters();
 
+        if ( params == null || params.isEmpty() )
+        {
+            append( buffer, "This mojo doesn't use any parameters.", 1 );
+            return;
+        }
+
+        // TODO remove when maven-plugin-tools-api:2.4.4 is out
         Collections.sort( params, new Comparator()
         {
             /** {@inheritDoc} */
@@ -727,16 +725,10 @@
                 Parameter parameter1 = (Parameter) o1;
                 Parameter parameter2 = (Parameter) o2;
 
-                return parameter1.getName().compareTo( parameter2.getName() );
+                return parameter1.getName().compareToIgnoreCase( parameter2.getName() );
             }
         } );
 
-        if ( params == null || params.isEmpty() )
-        {
-            append( buffer, "This mojo doesn't use any parameters.", 1 );
-            return;
-        }
-
         append( buffer, "Available parameters:", 1 );
 
         // indent 2