Author: bentmann
Date: Tue Aug 4 10:58:12 2009
New Revision: 800728
URL: http://svn.apache.org/viewvc?rev=800728&view=rev
Log:
[MNG-4280] [regression] Direct CLI invocation of goal causes "default-cli"
config to be processed twice, duplicating list values
Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/MojoExecution.java
Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL:
http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=800728&r1=800727&r2=800728&view=diff
==============================================================================
---
maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
(original)
+++
maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
Tue Aug 4 10:58:12 2009
@@ -332,7 +332,8 @@
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 @@
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 @@
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 @@
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 @@
}
}
- if ( directInvocation )
+ if ( allowPluginLevelConfig )
{
Xpp3Dom defaultDom = convert( mojoExecution.getMojoDescriptor() );
Modified:
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/MojoExecution.java
URL:
http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/MojoExecution.java?rev=800728&r1=800727&r2=800728&view=diff
==============================================================================
---
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/MojoExecution.java
(original)
+++
maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/MojoExecution.java
Tue Aug 4 10:58:12 2009
@@ -38,7 +38,26 @@
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 @@
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 @@
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;