mirror of https://github.com/apache/maven.git
o Tuned code
git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@833044 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c980cfb28d
commit
ed43cef785
|
@ -52,10 +52,10 @@ public class DefaultModelNormalizer
|
||||||
Build build = model.getBuild();
|
Build build = model.getBuild();
|
||||||
if ( build != null )
|
if ( build != null )
|
||||||
{
|
{
|
||||||
List<Plugin> original = build.getPlugins();
|
List<Plugin> plugins = build.getPlugins();
|
||||||
Map<Object, Plugin> normalized = new LinkedHashMap<Object, Plugin>();
|
Map<Object, Plugin> normalized = new LinkedHashMap<Object, Plugin>( plugins.size() * 2 );
|
||||||
|
|
||||||
for ( Plugin plugin : original )
|
for ( Plugin plugin : plugins )
|
||||||
{
|
{
|
||||||
Object key = plugin.getKey();
|
Object key = plugin.getKey();
|
||||||
Plugin first = normalized.get( key );
|
Plugin first = normalized.get( key );
|
||||||
|
@ -66,7 +66,10 @@ public class DefaultModelNormalizer
|
||||||
normalized.put( key, plugin );
|
normalized.put( key, plugin );
|
||||||
}
|
}
|
||||||
|
|
||||||
build.setPlugins( new ArrayList<Plugin>( normalized.values() ) );
|
if ( plugins.size() != normalized.size() )
|
||||||
|
{
|
||||||
|
build.setPlugins( new ArrayList<Plugin>( normalized.values() ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -76,12 +79,18 @@ public class DefaultModelNormalizer
|
||||||
* the way 2.x works. When we're in strict mode, the removal of duplicates just saves other merging steps from
|
* the way 2.x works. When we're in strict mode, the removal of duplicates just saves other merging steps from
|
||||||
* aftereffects and bogus error messages.
|
* aftereffects and bogus error messages.
|
||||||
*/
|
*/
|
||||||
Map<String, Dependency> dependencies = new LinkedHashMap<String, Dependency>();
|
List<Dependency> dependencies = model.getDependencies();
|
||||||
for ( Dependency dependency : model.getDependencies() )
|
Map<String, Dependency> normalized = new LinkedHashMap<String, Dependency>( dependencies.size() * 2 );
|
||||||
|
|
||||||
|
for ( Dependency dependency : dependencies )
|
||||||
{
|
{
|
||||||
dependencies.put( dependency.getManagementKey(), dependency );
|
normalized.put( dependency.getManagementKey(), dependency );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( dependencies.size() != normalized.size() )
|
||||||
|
{
|
||||||
|
model.setDependencies( new ArrayList<Dependency>( normalized.values() ) );
|
||||||
}
|
}
|
||||||
model.setDependencies( new ArrayList<Dependency>( dependencies.values() ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class DuplicateMerger
|
private static class DuplicateMerger
|
||||||
|
|
Loading…
Reference in New Issue