MNG-2926 - fixed plugin prefix searching order.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@526484 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brian E Fox 2007-04-07 21:05:22 +00:00
parent d74222128d
commit cab99dad59
1 changed files with 16 additions and 9 deletions

View File

@ -29,6 +29,7 @@ import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutio
import org.codehaus.plexus.logging.AbstractLogEnabled;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
@ -38,7 +39,8 @@ import java.util.Map;
* Manage plugin prefix to artifact ID mapping associations.
*
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
* @version $Id$
* @version $Id: DefaultPluginMappingManager.java 495147 2007-01-11 07:47:53Z
* jvanzyl $
*/
public class DefaultPluginMappingManager
extends AbstractLogEnabled
@ -79,7 +81,7 @@ public class DefaultPluginMappingManager
for ( Iterator it = pluginGroupIds.iterator(); it.hasNext(); )
{
String groupId = (String) it.next();
getLogger().debug( "Loading plugin prefixes from group: " + groupId );
try
{
loadPluginMappings( groupId, pluginRepositories, localRepository );
@ -109,15 +111,20 @@ public class DefaultPluginMappingManager
String prefix = mapping.getPrefix();
String artifactId = mapping.getArtifactId();
//if the prefix has already been found, don't add it again.
//this is to preserve the correct ordering of prefix searching (MNG-2926)
if ( !pluginDefinitionsByPrefix.containsKey( prefix ) )
{
String artifactId = mapping.getArtifactId();
org.apache.maven.model.Plugin plugin = new org.apache.maven.model.Plugin();
org.apache.maven.model.Plugin plugin = new org.apache.maven.model.Plugin();
plugin.setGroupId( metadata.getGroupId() );
plugin.setGroupId( metadata.getGroupId() );
plugin.setArtifactId( artifactId );
plugin.setArtifactId( artifactId );
pluginDefinitionsByPrefix.put( prefix, plugin );
pluginDefinitionsByPrefix.put( prefix, plugin );
}
}
}
}