mirror of
https://github.com/apache/maven.git
synced 2025-02-23 10:45:27 +00:00
o Corrected issue with inheritance of <dependencyManagement/>
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163326 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
da47c49f4f
commit
6eb196cc55
@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import org.apache.maven.model.Dependency;
|
import org.apache.maven.model.Dependency;
|
||||||
|
import org.apache.maven.model.DependencyManagement;
|
||||||
import org.apache.maven.model.Model;
|
import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.model.Plugin;
|
import org.apache.maven.model.Plugin;
|
||||||
import org.apache.maven.model.PostGoal;
|
import org.apache.maven.model.PostGoal;
|
||||||
@ -26,8 +27,11 @@
|
|||||||
import org.apache.maven.model.Scm;
|
import org.apache.maven.model.Scm;
|
||||||
import org.codehaus.plexus.util.StringUtils;
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
|
* @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
|
||||||
@ -322,5 +326,38 @@ public void assembleModelInheritance( Model child, Model parent )
|
|||||||
child.addPlugin( plugin );
|
child.addPlugin( plugin );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DependencyManagement parentDepMgmt = parent.getDependencyManagement();
|
||||||
|
DependencyManagement childDepMgmt = child.getDependencyManagement();
|
||||||
|
if(parentDepMgmt != null)
|
||||||
|
{
|
||||||
|
if(childDepMgmt == null)
|
||||||
|
{
|
||||||
|
child.setDependencyManagement(parentDepMgmt);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
List parentDeps = parentDepMgmt.getDependencies();
|
||||||
|
|
||||||
|
Map mappedParentDeps = new TreeMap();
|
||||||
|
for ( Iterator it = parentDeps.iterator(); it.hasNext(); )
|
||||||
|
{
|
||||||
|
Dependency dep = (Dependency) it.next();
|
||||||
|
mappedParentDeps.put(dep.getManagementKey(), dep);
|
||||||
|
}
|
||||||
|
|
||||||
|
List deps = new ArrayList(parentDeps);
|
||||||
|
for ( Iterator it = childDepMgmt.getDependencies().iterator(); it.hasNext(); )
|
||||||
|
{
|
||||||
|
Dependency dep = (Dependency) it.next();
|
||||||
|
if(!mappedParentDeps.containsKey(dep.getManagementKey()))
|
||||||
|
{
|
||||||
|
deps.add(dep);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
childDepMgmt.setDependencies(deps);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user