MNG-5768 @execution-id syntax for direct plugin goal invocation

Signed-off-by: Igor Fedorenko <ifedorenko@apache.org>
This commit is contained in:
Igor Fedorenko 2015-02-20 07:58:31 -05:00
parent cd52e5b51e
commit ee7dbab69d
2 changed files with 15 additions and 3 deletions

View File

@ -195,10 +195,16 @@ public class DefaultLifecycleExecutionPlanCalculator
{
String pluginGoal = ( (GoalTask) task ).pluginGoal;
String executionId = "default-cli";
int executionIdx = pluginGoal.indexOf( '@' );
if ( executionIdx > 0 )
{
executionId = pluginGoal.substring( executionIdx + 1 );
}
MojoDescriptor mojoDescriptor = mojoDescriptorCreator.getMojoDescriptor( pluginGoal, session, project );
MojoExecution mojoExecution =
new MojoExecution( mojoDescriptor, "default-cli", MojoExecution.Source.CLI );
MojoExecution mojoExecution = new MojoExecution( mojoDescriptor, executionId, MojoExecution.Source.CLI );
mojoExecutions.add( mojoExecution );
}

View File

@ -136,7 +136,7 @@ public class MojoDescriptorCreator
return dom;
}
// org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process
// org.apache.maven.plugins:maven-remote-resources-plugin:1.0:process@executionId
public MojoDescriptor getMojoDescriptor( String task, MavenSession session, MavenProject project )
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException,
@ -220,6 +220,12 @@ public class MojoDescriptorCreator
plugin = findPluginForPrefix( prefix, session );
}
int executionIdx = goal.indexOf( '@' );
if ( executionIdx > 0 )
{
goal = goal.substring( 0, executionIdx );
}
injectPluginDeclarationFromProject( plugin, project );
// If there is no version to be found then we need to look in the repository metadata for