From 724e4f39f4fed72f24d35527391be5c055cf6dfc Mon Sep 17 00:00:00 2001 From: Kenney Westerhof Date: Thu, 6 Jul 2006 17:28:00 +0000 Subject: [PATCH] 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 --- .../java/org/apache/maven/project/MavenProject.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/maven-project/src/main/java/org/apache/maven/project/MavenProject.java b/maven-project/src/main/java/org/apache/maven/project/MavenProject.java index 20e818c53d..574cf6368f 100644 --- a/maven-project/src/main/java/org/apache/maven/project/MavenProject.java +++ b/maven-project/src/main/java/org/apache/maven/project/MavenProject.java @@ -474,7 +474,7 @@ public class MavenProject if ( Artifact.SCOPE_COMPILE.equals( a.getScope() ) || Artifact.SCOPE_PROVIDED.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 ); if ( project != null ) { @@ -745,7 +745,7 @@ public class MavenProject // TODO: let the scope handler deal with this 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 ); if ( project != null ) { @@ -1553,12 +1553,12 @@ public class MavenProject 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() ) { - // TODO: use MavenProject getProjectReferenceId - String refId = ArtifactUtils.versionlessKey( pluginArtifact.getGroupId(), pluginArtifact.getArtifactId() ); + String refId = getProjectReferenceId( pluginArtifact.getGroupId(), pluginArtifact.getArtifactId(), pluginArtifact.getVersion() ); MavenProject ref = (MavenProject) getProjectReferences().get( refId ); if ( ref != null && ref.getArtifact() != null ) {