o revert part of r690203 and improved it
git-svn-id: https://svn.apache.org/repos/asf/maven/plugin-tools/trunk@690403 13f79535-47bb-0310-9956-ffa450edef68master
parent
a8b07dbe42
commit
27414b458d
|
|
@ -25,8 +25,6 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.Writer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
|
@ -453,18 +451,6 @@ public class PluginHelpGenerator
|
|||
|
||||
writer.write( LS );
|
||||
|
||||
Collections.sort( mojoDescriptors, 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 = mojoDescriptors.iterator(); it.hasNext(); )
|
||||
{
|
||||
MojoDescriptor descriptor = (MojoDescriptor) it.next();
|
||||
|
|
@ -514,17 +500,7 @@ public class PluginHelpGenerator
|
|||
{
|
||||
List params = descriptor.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() );
|
||||
}
|
||||
} );
|
||||
PluginUtils.sortMojoParameters( params );
|
||||
|
||||
writer.write( " if ( detail )" + LS );
|
||||
writer.write( " {" + LS );
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ import javax.swing.text.html.parser.ParserDelegator;
|
|||
import org.apache.maven.artifact.DependencyResolutionRequiredException;
|
||||
import org.apache.maven.model.Dependency;
|
||||
import org.apache.maven.plugin.descriptor.MojoDescriptor;
|
||||
import org.apache.maven.plugin.descriptor.Parameter;
|
||||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||
import org.apache.maven.project.MavenProject;
|
||||
import org.apache.maven.reporting.MavenReport;
|
||||
|
|
@ -413,6 +414,7 @@ public final class PluginUtils
|
|||
* Sorts the specified mojo descriptors by goal name.
|
||||
*
|
||||
* @param mojoDescriptors The mojo descriptors to sort, may be <code>null</code>.
|
||||
* @see MojoDescriptor#getGoal()
|
||||
*/
|
||||
public static void sortMojos( List mojoDescriptors )
|
||||
{
|
||||
|
|
@ -425,9 +427,34 @@ public final class PluginUtils
|
|||
{
|
||||
MojoDescriptor mojo0 = (MojoDescriptor) arg0;
|
||||
MojoDescriptor mojo1 = (MojoDescriptor) arg1;
|
||||
|
||||
return mojo0.getGoal().compareToIgnoreCase( mojo1.getGoal() );
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the specified mojo parameters by name.
|
||||
*
|
||||
* @param parameters The mojo parameters to sort, may be <code>null</code>.
|
||||
* @see Parameter#getName()
|
||||
* @since 2.4.4
|
||||
*/
|
||||
public static void sortMojoParameters( List parameters )
|
||||
{
|
||||
if ( parameters != null )
|
||||
{
|
||||
Collections.sort( parameters, new Comparator()
|
||||
{
|
||||
/** {@inheritDoc} */
|
||||
public int compare( Object arg0, Object arg1 )
|
||||
{
|
||||
Parameter parameter1 = (Parameter) arg0;
|
||||
Parameter parameter2 = (Parameter) arg1;
|
||||
|
||||
return parameter1.getName().compareToIgnoreCase( parameter2.getName() );
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue