diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java index c12b6f2b91..c89374a261 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java @@ -207,6 +207,8 @@ public class DefaultPluginManager pluginContainer.dispose(); + pluginCollector.flushPluginDescriptor( plugin ); + addPlugin( plugin, pluginArtifact, project, localRepository ); } diff --git a/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginCollector.java b/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginCollector.java index 22071d5f99..27b1848009 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginCollector.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginCollector.java @@ -25,6 +25,7 @@ import org.codehaus.plexus.logging.AbstractLogEnabled; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import java.util.Map; import java.util.Set; @@ -52,7 +53,7 @@ public class MavenPluginCollector // TODO: see comment in getPluginDescriptor String key = Plugin.constructKey( pluginDescriptor.getGroupId(), pluginDescriptor.getArtifactId() ); - + if ( !pluginsInProcess.contains( key ) ) { pluginsInProcess.add( key ); @@ -88,4 +89,20 @@ public class MavenPluginCollector return (PluginDescriptor) pluginIdsByPrefix.get( prefix ); } + public void flushPluginDescriptor( Plugin plugin ) + { + pluginsInProcess.remove( plugin.getKey() ); + pluginDescriptors.remove( plugin.getKey() ); + + for ( Iterator it = pluginIdsByPrefix.entrySet().iterator(); it.hasNext(); ) + { + Map.Entry entry = (Map.Entry) it.next(); + + if ( plugin.getKey().equals( entry.getValue() ) ) + { + it.remove(); + } + } + } + }