mirror of https://github.com/apache/maven.git
[MNG-4280] [regression] Direct CLI invocation of goal causes "default-cli" config to be processed twice, duplicating list values
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@800728 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
23862001bd
commit
a0f1eb3917
|
@ -332,7 +332,8 @@ public class DefaultLifecycleExecutor
|
|||
pluginDescriptor.setClassRealm( pluginManager.getPluginRealm( session, pluginDescriptor ) );
|
||||
}
|
||||
|
||||
populateMojoExecutionConfiguration( project, mojoExecution, false );
|
||||
populateMojoExecutionConfiguration( project, mojoExecution,
|
||||
MojoExecution.Source.CLI.equals( mojoExecution.getSource() ) );
|
||||
|
||||
calculateForkedExecutions( mojoExecution, session, project, new HashSet<MojoDescriptor>() );
|
||||
|
||||
|
@ -361,8 +362,6 @@ public class DefaultLifecycleExecutor
|
|||
private void calculateExecutionForIndividualGoal( MavenSession session, List<MojoExecution> lifecyclePlan, String goal )
|
||||
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, CycleDetectedInPluginGraphException, MojoNotFoundException, NoPluginFoundForPrefixException, InvalidPluginDescriptorException
|
||||
{
|
||||
MavenProject project = session.getCurrentProject();
|
||||
|
||||
// If this is a goal like "mvn modello:java" and the POM looks like the following:
|
||||
//
|
||||
// <project>
|
||||
|
@ -395,9 +394,7 @@ public class DefaultLifecycleExecutor
|
|||
|
||||
MojoDescriptor mojoDescriptor = getMojoDescriptor( goal, session );
|
||||
|
||||
MojoExecution mojoExecution = new MojoExecution( mojoDescriptor, "default-cli" );
|
||||
|
||||
populateMojoExecutionConfiguration( project, mojoExecution, true );
|
||||
MojoExecution mojoExecution = new MojoExecution( mojoDescriptor, "default-cli", MojoExecution.Source.CLI );
|
||||
|
||||
lifecyclePlan.add( mojoExecution );
|
||||
}
|
||||
|
@ -674,7 +671,8 @@ public class DefaultLifecycleExecutor
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
private void populateMojoExecutionConfiguration( MavenProject project, MojoExecution mojoExecution, boolean directInvocation )
|
||||
private void populateMojoExecutionConfiguration( MavenProject project, MojoExecution mojoExecution,
|
||||
boolean allowPluginLevelConfig )
|
||||
{
|
||||
String g = mojoExecution.getGroupId();
|
||||
|
||||
|
@ -702,7 +700,7 @@ public class DefaultLifecycleExecutor
|
|||
}
|
||||
}
|
||||
|
||||
if ( directInvocation )
|
||||
if ( allowPluginLevelConfig )
|
||||
{
|
||||
Xpp3Dom defaultDom = convert( mojoExecution.getMojoDescriptor() );
|
||||
|
||||
|
|
|
@ -38,7 +38,26 @@ public class MojoExecution
|
|||
private MojoDescriptor mojoDescriptor;
|
||||
|
||||
private Xpp3Dom configuration;
|
||||
|
||||
|
||||
/**
|
||||
* Describes the source of an execution.
|
||||
*/
|
||||
public enum Source
|
||||
{
|
||||
|
||||
/**
|
||||
* An execution that originates from the direct invocation of a goal from the CLI.
|
||||
*/
|
||||
CLI,
|
||||
|
||||
/**
|
||||
* An execution that originates from a goal bound to a lifecycle phase.
|
||||
*/
|
||||
LIFECYCLE,
|
||||
}
|
||||
|
||||
private Source source;
|
||||
|
||||
/**
|
||||
* The phase may or may not have been bound to a phase but once the plan has been calculated we know what phase
|
||||
* this mojo execution is going to run in.
|
||||
|
@ -61,6 +80,14 @@ public class MojoExecution
|
|||
this.configuration = null;
|
||||
}
|
||||
|
||||
public MojoExecution( MojoDescriptor mojoDescriptor, String executionId, Source source )
|
||||
{
|
||||
this.mojoDescriptor = mojoDescriptor;
|
||||
this.executionId = executionId;
|
||||
this.configuration = null;
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
public MojoExecution( MojoDescriptor mojoDescriptor, String executionId )
|
||||
{
|
||||
this.mojoDescriptor = mojoDescriptor;
|
||||
|
@ -75,6 +102,16 @@ public class MojoExecution
|
|||
this.executionId = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the source of this execution.
|
||||
*
|
||||
* @return The source of this execution or {@code null} if unknown.
|
||||
*/
|
||||
public Source getSource()
|
||||
{
|
||||
return source;
|
||||
}
|
||||
|
||||
public String getExecutionId()
|
||||
{
|
||||
return executionId;
|
||||
|
|
Loading…
Reference in New Issue