Fix for mng-3259.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@713483 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Britton Isbell 2008-11-12 20:01:20 +00:00
parent 4378d40c7b
commit c46e4fd97c
1 changed files with 25 additions and 32 deletions

View File

@ -71,6 +71,8 @@ public final class ArtifactModelContainerFactory
private String type; private String type;
private String scope;
private List<ModelProperty> properties; private List<ModelProperty> properties;
private static String findBaseUriFrom( List<ModelProperty> modelProperties ) private static String findBaseUriFrom( List<ModelProperty> modelProperties )
@ -106,6 +108,10 @@ public final class ArtifactModelContainerFactory
{ {
this.groupId = mp.getResolvedValue(); 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 ) else if ( type == null && mp.getUri().equals( ProjectUri.Dependencies.Dependency.type )
|| mp.getUri().equals(ProjectUri.DependencyManagement.Dependencies.Dependency.type) || mp.getUri().equals(ProjectUri.DependencyManagement.Dependencies.Dependency.type)
|| mp.getUri().equals(ProjectUri.Build.PluginManagement.Plugins.Plugin.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 ); ", Version = " + version + ", Base = " + uri + ":\r\n" + sb );
} }
if ( version == null )
{
version = "";
}
if ( type == null ) if ( type == null )
{ {
type = ""; type = "";
} }
if ( scope == null )
{
scope = "";
}
} }
public ModelContainerAction containerAction( ModelContainer modelContainer ) public ModelContainerAction containerAction( ModelContainer modelContainer )
@ -153,39 +169,9 @@ public final class ArtifactModelContainerFactory
ArtifactModelContainer c = (ArtifactModelContainer) modelContainer; ArtifactModelContainer c = (ArtifactModelContainer) modelContainer;
if ( c.groupId.equals( groupId ) && c.artifactId.equals( artifactId ) ) 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.version.equals( version ) )
{ {
if ( c.type.equals( type ) ) if ( c.type.equals( type ) )
{ {
return ModelContainerAction.JOIN; return ModelContainerAction.JOIN;
} }
@ -196,7 +182,14 @@ public final class ArtifactModelContainerFactory
} }
else else
{ {
return ModelContainerAction.DELETE; if ( c.type.equals( type ) )
{
return ModelContainerAction.DELETE;
}
else
{
return ModelContainerAction.NOP;
}
} }
} }
else else