managedExclusions );
}
public DependencyManagement manageDependency( Dependency dependency )
{
DependencyManagement management = null;
Object key = getKey( dependency.getArtifact() );
if ( depth >= 2 )
{
String version = managedVersions.get( key );
if ( version != null )
{
if ( management == null )
{
management = new DependencyManagement();
}
management.setVersion( version );
}
String scope = managedScopes.get( key );
if ( scope != null )
{
if ( management == null )
{
management = new DependencyManagement();
}
management.setScope( scope );
if ( !JavaScopes.SYSTEM.equals( scope )
&& dependency.getArtifact().getProperty( ArtifactProperties.LOCAL_PATH, null ) != null )
{
Map<String, String> properties =
new HashMap<String, String>( dependency.getArtifact().getProperties() );
properties.remove( ArtifactProperties.LOCAL_PATH );
management.setProperties( properties );
}
}
if ( ( scope != null && JavaScopes.SYSTEM.equals( scope ) )
|| ( scope == null && JavaScopes.SYSTEM.equals( dependency.getScope() ) ) )
{
String localPath = managedLocalPaths.get( key );
if ( localPath != null )
{
if ( management == null )
{
management = new DependencyManagement();
}
Map<String, String> properties =
new HashMap<String, String>( dependency.getArtifact().getProperties() );
properties.put( ArtifactProperties.LOCAL_PATH, localPath );
management.setProperties( properties );
}
}
}
Collection<Exclusion> exclusions = managedExclusions.get( key );
if ( exclusions != null )
{
if ( management == null )
{
management = new DependencyManagement();
}
Collection<Exclusion> result = new LinkedHashSet<Exclusion>( dependency.getExclusions() );
result.addAll( exclusions );
management.setExclusions( result );
}
return management;
}