mirror of https://github.com/apache/maven.git
additional rule about SNAPSHOTs
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@219475 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
640667a6a2
commit
148aac1ba9
|
@ -65,7 +65,22 @@ public class DefaultArtifactVersion
|
|||
{
|
||||
if ( otherVersion.qualifier != null )
|
||||
{
|
||||
result = qualifier.compareTo( otherVersion.qualifier );
|
||||
if ( qualifier.length() > otherVersion.qualifier.length() &&
|
||||
qualifier.startsWith( otherVersion.qualifier ) )
|
||||
{
|
||||
// here, the longer one that otherwise match is considered older
|
||||
result = -1;
|
||||
}
|
||||
else if ( qualifier.length() < otherVersion.qualifier.length() &&
|
||||
otherVersion.qualifier.startsWith( qualifier ) )
|
||||
{
|
||||
// here, the longer one that otherwise match is considered older
|
||||
result = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
result = qualifier.compareTo( otherVersion.qualifier );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -137,6 +137,18 @@ public class DefaultArtifactVersionTest
|
|||
version = new DefaultArtifactVersion( "1.0-SNAPSHOT" );
|
||||
assertTrue( version.compareTo( new DefaultArtifactVersion( "1.0-beta-1" ) ) < 0 );
|
||||
|
||||
version = new DefaultArtifactVersion( "1.0-SNAPSHOT" );
|
||||
assertTrue( version.compareTo( new DefaultArtifactVersion( "1.0" ) ) < 0 );
|
||||
|
||||
version = new DefaultArtifactVersion( "1.0" );
|
||||
assertTrue( version.compareTo( new DefaultArtifactVersion( "1.0-SNAPSHOT" ) ) > 0 );
|
||||
|
||||
version = new DefaultArtifactVersion( "1.0-alpha-1-SNAPSHOT" );
|
||||
assertTrue( version.compareTo( new DefaultArtifactVersion( "1.0-alpha-1" ) ) < 0 );
|
||||
|
||||
version = new DefaultArtifactVersion( "1.0-alpha-1" );
|
||||
assertTrue( version.compareTo( new DefaultArtifactVersion( "1.0-alpha-1-SNAPSHOT" ) ) > 0 );
|
||||
|
||||
version = new DefaultArtifactVersion( "1.0" );
|
||||
assertTrue( version.compareTo( new DefaultArtifactVersion( "1.0-1" ) ) < 0 );
|
||||
|
||||
|
|
Loading…
Reference in New Issue