mirror of https://github.com/apache/maven.git
o put the plugin groups in the front-end request populator, the magic plugin groups are no longer buried in the core. could still be
moved from the code in the populator to a configuration file in the maven installation. git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@776556 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9dfca575c7
commit
d5459955f5
|
@ -462,7 +462,7 @@ public class DefaultLifecycleExecutor
|
||||||
// From the metadata stored on the server which has been created as part of a standard
|
// From the metadata stored on the server which has been created as part of a standard
|
||||||
// Maven plugin deployment we will find the right PluginDescriptor from the remote
|
// Maven plugin deployment we will find the right PluginDescriptor from the remote
|
||||||
// repository.
|
// repository.
|
||||||
|
|
||||||
plugin = findPluginForPrefix( prefix, session );
|
plugin = findPluginForPrefix( prefix, session );
|
||||||
}
|
}
|
||||||
else if ( numTokens == 3 || numTokens == 4 )
|
else if ( numTokens == 3 || numTokens == 4 )
|
||||||
|
@ -819,20 +819,23 @@ public class DefaultLifecycleExecutor
|
||||||
|
|
||||||
private Map<String,Plugin> pluginPrefixes = new HashMap<String,Plugin>();
|
private Map<String,Plugin> pluginPrefixes = new HashMap<String,Plugin>();
|
||||||
|
|
||||||
|
//TODO: take repo mans into account as one may be aggregating prefixes of many
|
||||||
|
//TODO: collect at the root of the repository, read the one at the root, and fetch remote if something is missing
|
||||||
|
// or the user forces the issue
|
||||||
public Plugin findPluginForPrefix( String prefix, MavenSession session )
|
public Plugin findPluginForPrefix( String prefix, MavenSession session )
|
||||||
throws NoPluginFoundForPrefixException
|
throws NoPluginFoundForPrefixException
|
||||||
{
|
{
|
||||||
// [prefix]:[goal]
|
// [prefix]:[goal]
|
||||||
|
|
||||||
Plugin plugin = pluginPrefixes.get( prefix );
|
Plugin plugin = pluginPrefixes.get( prefix );
|
||||||
|
|
||||||
if ( plugin != null )
|
if ( plugin != null )
|
||||||
{
|
{
|
||||||
return plugin;
|
return plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( ArtifactRepository repository : session.getCurrentProject().getRemoteArtifactRepositories() )
|
for ( ArtifactRepository repository : session.getCurrentProject().getRemoteArtifactRepositories() )
|
||||||
{
|
{
|
||||||
for ( String pluginGroup : session.getPluginGroups() )
|
for ( String pluginGroup : session.getPluginGroups() )
|
||||||
{
|
{
|
||||||
// org.apache.maven.plugins
|
// org.apache.maven.plugins
|
||||||
|
@ -862,7 +865,7 @@ public class DefaultLifecycleExecutor
|
||||||
|
|
||||||
// We have retrieved the metadata
|
// We have retrieved the metadata
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Metadata pluginGroupMetadata = readMetadata( destination );
|
Metadata pluginGroupMetadata = readMetadata( destination );
|
||||||
|
|
||||||
List<org.apache.maven.artifact.repository.metadata.Plugin> plugins = pluginGroupMetadata.getPlugins();
|
List<org.apache.maven.artifact.repository.metadata.Plugin> plugins = pluginGroupMetadata.getPlugins();
|
||||||
|
|
|
@ -162,4 +162,15 @@ public class LifecycleExecutorTest
|
||||||
assertEquals( "org.apache.maven.plugins", plugin.getGroupId() );
|
assertEquals( "org.apache.maven.plugins", plugin.getGroupId() );
|
||||||
assertEquals( "maven-resources-plugin", plugin.getArtifactId() );
|
assertEquals( "maven-resources-plugin", plugin.getArtifactId() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prefixes
|
||||||
|
|
||||||
|
public void testFindingPluginPrefixforCleanClean()
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
File pom = getProject( "project-with-additional-lifecycle-elements" );
|
||||||
|
MavenSession session = createMavenSession( pom );
|
||||||
|
Plugin plugin = lifecycleExecutor.findPluginForPrefix( "clean", session );
|
||||||
|
assertNotNull( plugin );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ package org.apache.maven.embedder.execution;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
@ -57,6 +58,8 @@ public class DefaultMavenExecutionRequestPopulator
|
||||||
{
|
{
|
||||||
pom( request, configuration );
|
pom( request, configuration );
|
||||||
|
|
||||||
|
populateDefaultPluginGroups( request, configuration );
|
||||||
|
|
||||||
settings( request, configuration );
|
settings( request, configuration );
|
||||||
|
|
||||||
localRepository( request, configuration );
|
localRepository( request, configuration );
|
||||||
|
@ -94,6 +97,14 @@ public class DefaultMavenExecutionRequestPopulator
|
||||||
request.setBaseDirectory( new File( System.getProperty( "user.dir" ) ) );
|
request.setBaseDirectory( new File( System.getProperty( "user.dir" ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void populateDefaultPluginGroups( MavenExecutionRequest request, Configuration configuration )
|
||||||
|
{
|
||||||
|
List<String> pluginGroups = new ArrayList<String>();
|
||||||
|
pluginGroups.add( "org.apache.maven.plugins" );
|
||||||
|
pluginGroups.add( "org.codehaus.mojo" );
|
||||||
|
request.setPluginGroups( pluginGroups );
|
||||||
|
}
|
||||||
|
|
||||||
// Process plugin groups
|
// Process plugin groups
|
||||||
// Get profile models
|
// Get profile models
|
||||||
|
@ -102,8 +113,8 @@ public class DefaultMavenExecutionRequestPopulator
|
||||||
throws MavenEmbedderException
|
throws MavenEmbedderException
|
||||||
{
|
{
|
||||||
Settings settings = request.getSettings();
|
Settings settings = request.getSettings();
|
||||||
|
|
||||||
request.setPluginGroups( settings.getPluginGroups() );
|
request.getPluginGroups().addAll( settings.getPluginGroups() );
|
||||||
|
|
||||||
List<org.apache.maven.settings.Profile> settingsProfiles = settings.getProfiles();
|
List<org.apache.maven.settings.Profile> settingsProfiles = settings.getProfiles();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue