PR: MNG-593

ensure there are no duplicates in the assembled model's dependency list

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@220344 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-07-22 15:36:34 +00:00
parent 7073a7c7ad
commit 8c3bbcc397
2 changed files with 16 additions and 6 deletions

View File

@ -218,9 +218,9 @@ public class MavenProject
}
}
public void setDependencies( List denpendencies )
public void setDependencies( List dependencies )
{
model.setDependencies( denpendencies );
model.setDependencies( dependencies );
}
public List getDependencies()

View File

@ -165,12 +165,22 @@ public class DefaultModelInheritanceAssembler
// Dependencies :: aggregate
List dependencies = parent.getDependencies();
for ( Iterator iterator = dependencies.iterator(); iterator.hasNext(); )
List childDeps = child.getDependencies();
Map mappedChildDeps = new TreeMap();
for ( Iterator it = childDeps.iterator(); it.hasNext(); )
{
Dependency dependency = (Dependency) iterator.next();
child.addDependency( dependency );
Dependency dep = (Dependency) it.next();
mappedChildDeps.put( dep.getManagementKey(), dep );
}
for ( Iterator it = parent.getDependencies().iterator(); it.hasNext(); )
{
Dependency dep = (Dependency) it.next();
if ( !mappedChildDeps.containsKey( dep.getManagementKey() ) )
{
child.addDependency( dep );
}
}
// Repositories :: aggregate