PR: MNG-1245

Version not taken into account for reactor projects. 

Artifacts for reactor projects get replaced by a wrong version local repo artifact.


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@419624 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Kenney Westerhof 2006-07-06 17:28:00 +00:00
parent ebe77642b4
commit 724e4f39f4
1 changed files with 6 additions and 7 deletions

View File

@ -474,7 +474,7 @@ public class MavenProject
if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) || if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.equals( a.getScope() ) ||
Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
{ {
String refId = getProjectReferenceId( a.getGroupId(), a.getArtifactId() ); String refId = getProjectReferenceId( a.getGroupId(), a.getArtifactId(), a.getVersion() );
MavenProject project = (MavenProject) projectReferences.get( refId ); MavenProject project = (MavenProject) projectReferences.get( refId );
if ( project != null ) if ( project != null )
{ {
@ -745,7 +745,7 @@ public class MavenProject
// TODO: let the scope handler deal with this // TODO: let the scope handler deal with this
if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) ) if ( Artifact.SCOPE_SYSTEM.equals( a.getScope() ) )
{ {
String refId = getProjectReferenceId( a.getGroupId(), a.getArtifactId() ); String refId = getProjectReferenceId( a.getGroupId(), a.getArtifactId(), a.getVersion() );
MavenProject project = (MavenProject) projectReferences.get( refId ); MavenProject project = (MavenProject) projectReferences.get( refId );
if ( project != null ) if ( project != null )
{ {
@ -1553,12 +1553,12 @@ public class MavenProject
public void addProjectReference( MavenProject project ) public void addProjectReference( MavenProject project )
{ {
projectReferences.put( getProjectReferenceId( project.getGroupId(), project.getArtifactId() ), project ); projectReferences.put( getProjectReferenceId( project.getGroupId(), project.getArtifactId(), project.getVersion() ), project );
} }
private static String getProjectReferenceId( String groupId, String artifactId ) private static String getProjectReferenceId( String groupId, String artifactId, String version )
{ {
return groupId + ":" + artifactId; return groupId + ":" + artifactId + ":" + version;
} }
/** /**
@ -1602,8 +1602,7 @@ public class MavenProject
{ {
if ( getProjectReferences() != null && !getProjectReferences().isEmpty() ) if ( getProjectReferences() != null && !getProjectReferences().isEmpty() )
{ {
// TODO: use MavenProject getProjectReferenceId String refId = getProjectReferenceId( pluginArtifact.getGroupId(), pluginArtifact.getArtifactId(), pluginArtifact.getVersion() );
String refId = ArtifactUtils.versionlessKey( pluginArtifact.getGroupId(), pluginArtifact.getArtifactId() );
MavenProject ref = (MavenProject) getProjectReferences().get( refId ); MavenProject ref = (MavenProject) getProjectReferences().get( refId );
if ( ref != null && ref.getArtifact() != null ) if ( ref != null && ref.getArtifact() != null )
{ {