From c46e4fd97c08ab56ce8c58f467baeee5beccc77f Mon Sep 17 00:00:00 2001 From: Britton Isbell Date: Wed, 12 Nov 2008 20:01:20 +0000 Subject: [PATCH] Fix for mng-3259. git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@713483 13f79535-47bb-0310-9956-ffa450edef68 --- .../ArtifactModelContainerFactory.java | 57 ++++++++----------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java b/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java index f11b532eb4..3d3dd964c0 100644 --- a/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java +++ b/maven-project/src/main/java/org/apache/maven/project/builder/ArtifactModelContainerFactory.java @@ -71,6 +71,8 @@ public final class ArtifactModelContainerFactory private String type; + private String scope; + private List properties; private static String findBaseUriFrom( List modelProperties ) @@ -106,6 +108,10 @@ public final class ArtifactModelContainerFactory { this.groupId = mp.getResolvedValue(); } + else if ( scope == null && mp.getUri().equals( uri + "/scope" ) ) + { + this.scope = mp.getResolvedValue(); + } else if ( type == null && mp.getUri().equals( ProjectUri.Dependencies.Dependency.type ) || mp.getUri().equals(ProjectUri.DependencyManagement.Dependencies.Dependency.type) || mp.getUri().equals(ProjectUri.Build.PluginManagement.Plugins.Plugin.Dependencies.Dependency.type) @@ -132,10 +138,20 @@ public final class ArtifactModelContainerFactory ", Version = " + version + ", Base = " + uri + ":\r\n" + sb ); } + if ( version == null ) + { + version = ""; + } + if ( type == null ) { type = ""; } + + if ( scope == null ) + { + scope = ""; + } } public ModelContainerAction containerAction( ModelContainer modelContainer ) @@ -153,39 +169,9 @@ public final class ArtifactModelContainerFactory ArtifactModelContainer c = (ArtifactModelContainer) modelContainer; if ( c.groupId.equals( groupId ) && c.artifactId.equals( artifactId ) ) { - if ( c.version == null ) - { - if ( version == null ) - { - if ( c.type.equals( type ) ) - { - return ModelContainerAction.JOIN; - } - else - { - return ModelContainerAction.NOP; - } - } - return ModelContainerAction.JOIN; - } - if ( version == null ) - { - if ( c.version == null ) - { - if ( c.type.equals( type ) ) - { - return ModelContainerAction.JOIN; - } - else - { - return ModelContainerAction.NOP; - } - } - return ModelContainerAction.JOIN; - } if ( c.version.equals( version ) ) { - if ( c.type.equals( type ) ) + if ( c.type.equals( type ) ) { return ModelContainerAction.JOIN; } @@ -196,7 +182,14 @@ public final class ArtifactModelContainerFactory } else { - return ModelContainerAction.DELETE; + if ( c.type.equals( type ) ) + { + return ModelContainerAction.DELETE; + } + else + { + return ModelContainerAction.NOP; + } } } else