mirror of https://github.com/apache/maven.git
o Fixed inconsistent behavior of version getters
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@816133 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
5d459b0c0e
commit
eeeee17821
|
@ -357,14 +357,11 @@ public class DefaultArtifact
|
|||
|
||||
public String getBaseVersion()
|
||||
{
|
||||
if ( baseVersion == null )
|
||||
if ( baseVersion == null && version != null )
|
||||
{
|
||||
if ( version == null )
|
||||
{
|
||||
throw new NullPointerException( "version was null for " + groupId + ":" + artifactId );
|
||||
}
|
||||
setBaseVersionInternal( version );
|
||||
}
|
||||
|
||||
return baseVersion;
|
||||
}
|
||||
|
||||
|
|
|
@ -127,4 +127,14 @@ public class DefaultArtifactTest
|
|||
assertTrue( artifact.compareTo( artifact1 ) == 0 );
|
||||
assertTrue( artifact1.compareTo( artifact ) == 0 );
|
||||
}
|
||||
|
||||
public void testNonResolvedVersionRangeConsistentlyYieldsNullVersions()
|
||||
throws Exception
|
||||
{
|
||||
VersionRange vr = VersionRange.createFromVersionSpec( "[1.0,2.0)" );
|
||||
artifact = new DefaultArtifact( groupId, artifactId, vr, scope, type, null, artifactHandler );
|
||||
assertEquals( null, artifact.getVersion() );
|
||||
assertEquals( null, artifact.getBaseVersion() );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue