correctly align versions during mediation

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@226813 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-08-01 15:02:43 +00:00
parent 4a094fd1f1
commit acdef905ac
3 changed files with 16 additions and 6 deletions

View File

@ -75,7 +75,7 @@ public class SnapshotTransformation
metadata.update();
artifact.setVersion( metadata.constructVersion() );
artifact.setResolvedVersion( metadata.constructVersion() );
artifact.addMetadata( metadata );
}

View File

@ -128,9 +128,10 @@ public interface Artifact
void setArtifactId( String artifactId );
boolean isSnapshot();
void setResolved( boolean resolved );
boolean isResolved();
void setResolvedVersion( String version );
}

View File

@ -72,7 +72,7 @@ public class DefaultArtifact
private VersionRange versionRange;
private boolean resolved = false;
private boolean resolved;
public DefaultArtifact( String groupId, String artifactId, VersionRange versionRange, String scope, String type,
String classifier, ArtifactHandler artifactHandler )
@ -164,6 +164,7 @@ public class DefaultArtifact
public void setVersion( String version )
{
this.version = version;
this.baseVersion = version;
this.versionRange = null;
}
@ -346,7 +347,7 @@ public class DefaultArtifact
public void updateVersion( String version, ArtifactRepository localRepository )
{
setVersion( version );
setResolvedVersion( version );
setFile( new File( localRepository.getBasedir(), localRepository.pathOf( this ) ) );
}
@ -401,17 +402,19 @@ public class DefaultArtifact
if ( versionRange != null && versionRange.getRecommendedVersion() != null )
{
this.version = versionRange.getRecommendedVersion().toString();
selectVersion( versionRange.getRecommendedVersion().toString() );
}
else
{
this.version = null;
this.baseVersion = null;
}
}
public void selectVersion( String version )
{
this.version = version;
this.baseVersion = version;
}
public void setGroupId( String groupId )
@ -448,4 +451,10 @@ public class DefaultArtifact
return resolved;
}
public void setResolvedVersion( String version )
{
this.version = version;
// retain baseVersion
}
}