o Fixed formats for inheritance assembler additions

o Removed unused import on defaults injector.


git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@163331 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-02-02 22:14:46 +00:00
parent 64f75b8aa0
commit 2ce3a6cbde
2 changed files with 18 additions and 18 deletions

View File

@ -9,7 +9,6 @@ import java.util.TreeMap;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.DependencyManagement;
import org.codehaus.plexus.util.StringUtils;
/**
* @author jdcasey Created on Feb 1, 2005

View File

@ -140,14 +140,13 @@ public class DefaultModelInheritanceAssembler
child.setScm( childScm );
}
if ( StringUtils.isEmpty( childScm.getConnection() ) &&
!StringUtils.isEmpty( parentScm.getConnection() ) )
if ( StringUtils.isEmpty( childScm.getConnection() ) && !StringUtils.isEmpty( parentScm.getConnection() ) )
{
childScm.setConnection( parentScm.getConnection() + "/" + child.getArtifactId() );
}
if ( StringUtils.isEmpty( childScm.getDeveloperConnection() ) &&
!StringUtils.isEmpty( parentScm.getDeveloperConnection() ) )
if ( StringUtils.isEmpty( childScm.getDeveloperConnection() )
&& !StringUtils.isEmpty( parentScm.getDeveloperConnection() ) )
{
childScm.setDeveloperConnection( parentScm.getDeveloperConnection() + "/" + child.getArtifactId() );
}
@ -326,38 +325,40 @@ public class DefaultModelInheritanceAssembler
child.addPlugin( plugin );
}
}
DependencyManagement parentDepMgmt = parent.getDependencyManagement();
DependencyManagement childDepMgmt = child.getDependencyManagement();
if(parentDepMgmt != null)
if ( parentDepMgmt != null )
{
if(childDepMgmt == null)
if ( childDepMgmt == null )
{
child.setDependencyManagement(parentDepMgmt);
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);
mappedParentDeps.put( dep.getManagementKey(), dep );
}
List deps = new ArrayList(parentDeps);
List deps = new ArrayList( parentDeps );
for ( Iterator it = childDepMgmt.getDependencies().iterator(); it.hasNext(); )
{
Dependency dep = (Dependency) it.next();
if(!mappedParentDeps.containsKey(dep.getManagementKey()))
if ( !mappedParentDeps.containsKey( dep.getManagementKey() ) )
{
deps.add(dep);
deps.add( dep );
}
}
childDepMgmt.setDependencies(deps);
childDepMgmt.setDependencies( deps );
}
}
}
}
}