Adding code to flush the plugin collector when reloading the plugin container, so that discovery will proceed normally in the new container instance.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@314798 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2005-10-12 06:16:16 +00:00
parent 36c7208f9f
commit 41be861bed
2 changed files with 20 additions and 1 deletions

View File

@ -207,6 +207,8 @@ public class DefaultPluginManager
pluginContainer.dispose();
pluginCollector.flushPluginDescriptor( plugin );
addPlugin( plugin, pluginArtifact, project, localRepository );
}

View File

@ -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();
}
}
}
}