mirror of https://github.com/apache/maven.git
[MNG-6967] Improve the command line output from maven-artifact.
This commit is contained in:
parent
8f58b85eaf
commit
9189425150
|
@ -590,6 +590,32 @@ public class ComparableVersion
|
|||
}
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the contents in the same format that is used when you call toString() on a List.
|
||||
*/
|
||||
private String toListString()
|
||||
{
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append( "[" );
|
||||
for ( Item item : this )
|
||||
{
|
||||
if ( buffer.length() > 1 )
|
||||
{
|
||||
buffer.append( ", " );
|
||||
}
|
||||
if ( item instanceof ListItem )
|
||||
{
|
||||
buffer.append( ( (ListItem ) item ).toListString() );
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer.append( item );
|
||||
}
|
||||
}
|
||||
buffer.append( "]" );
|
||||
return buffer.toString();
|
||||
}
|
||||
}
|
||||
|
||||
public ComparableVersion( String version )
|
||||
|
@ -773,10 +799,10 @@ public class ComparableVersion
|
|||
* @param args the version strings to parse and compare. You can pass arbitrary number of version strings and always
|
||||
* two adjacent will be compared
|
||||
*/
|
||||
// CHECKSTYLE_ON: LineLength
|
||||
public static void main( String... args )
|
||||
{
|
||||
System.out.println( "Display parameters as parsed by Maven (in canonical form) and comparison result:" );
|
||||
System.out.println( "Display parameters as parsed by Maven (in canonical form and as a list of tokens) and"
|
||||
+ " comparison result:" );
|
||||
if ( args.length == 0 )
|
||||
{
|
||||
return;
|
||||
|
@ -795,9 +821,10 @@ public class ComparableVersion
|
|||
+ ( ( compare == 0 ) ? "==" : ( ( compare < 0 ) ? "<" : ">" ) ) + ' ' + version );
|
||||
}
|
||||
|
||||
System.out.println( String.valueOf( i++ ) + ". " + version + " == " + c.getCanonical() );
|
||||
System.out.println( ( i++ ) + ". " + version + " -> " + c.getCanonical() + "; tokens: " + c.items.toListString() );
|
||||
|
||||
prev = c;
|
||||
}
|
||||
}
|
||||
// CHECKSTYLE_ON: LineLength
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue