[MNG-4344] [regression] Managed executions of plugins introduced by default lifecycle bindings execute before explicitly defined plugins

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-3/trunk@812550 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-09-08 15:24:19 +00:00
parent 53b7d5e805
commit 73d7e4f891
1 changed files with 8 additions and 34 deletions

View File

@ -22,7 +22,6 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
@ -104,41 +103,30 @@ protected void mergePluginContainer_Plugins( PluginContainer target, PluginConta
{
List<Plugin> tgt = target.getPlugins();
Map<Object, Plugin> merged = new LinkedHashMap<Object, Plugin>( src.size() * 2 );
Map<Object, Plugin> merged = new LinkedHashMap<Object, Plugin>( ( src.size() + tgt.size() ) * 2 );
for ( Iterator<Plugin> it = src.iterator(); it.hasNext(); )
for ( Iterator<Plugin> it = tgt.iterator(); it.hasNext(); )
{
Plugin element = it.next();
Object key = getPluginKey( element );
merged.put( key, element );
}
Map<Object, Plugin> unmanaged = new LinkedHashMap<Object, Plugin>( merged );
Map<Object, Plugin> unmanaged = new LinkedHashMap<Object, Plugin>();
Map<Object, List<Plugin>> predecessors = new HashMap<Object, List<Plugin>>();
List<Plugin> pending = new ArrayList<Plugin>( tgt.size() );
for ( Iterator<Plugin> it = tgt.iterator(); it.hasNext(); )
for ( Iterator<Plugin> it = src.iterator(); it.hasNext(); )
{
Plugin element = it.next();
Object key = getPluginKey( element );
Plugin existing = merged.get( key );
if ( existing != null )
{
mergePlugin( element, existing, sourceDominant, context );
unmanaged.remove( key );
merged.put( key, element );
if ( !pending.isEmpty() )
{
predecessors.put( key, pending );
pending = new ArrayList<Plugin>();
}
mergePlugin( existing, element, sourceDominant, context );
}
else
{
pending.add( element );
merged.put( key, element );
unmanaged.put( key, element );
}
}
@ -162,21 +150,7 @@ protected void mergePluginContainer_Plugins( PluginContainer target, PluginConta
}
}
List<Plugin> result = new ArrayList<Plugin>( src.size() + tgt.size() );
for ( Map.Entry<Object, Plugin> entry : merged.entrySet() )
{
List<Plugin> pre = predecessors.get( entry.getKey() );
if ( pre != null )
{
result.addAll( pre );
}
result.add( entry.getValue() );
}
result.addAll( pending );
List<Plugin> result = new ArrayList<Plugin>( merged.values() );
target.setPlugins( result );
}