You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jd...@apache.org on 2009/06/10 03:31:07 UTC
svn commit: r783173 - in
/maven/components/branches/maven-2.2.0-RC/maven-core/src/main/java/org/apache/maven:
lifecycle/DefaultLifecycleExecutor.java plugin/MojoExecution.java
Author: jdcasey
Date: Wed Jun 10 01:31:06 2009
New Revision: 783173
URL: http://svn.apache.org/viewvc?rev=783173&view=rev
Log:
[MNG-3401][MNG-3203] run default-lifecycle bindings and CLI invocations of mojos using 'default-<goalname>' and 'default-cli' executionIds respectively. For reports and forked executions that use executionIds, those will be preserved. For others, the executionId of the forking mojo will be used.
Modified:
maven/components/branches/maven-2.2.0-RC/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
maven/components/branches/maven-2.2.0-RC/maven-core/src/main/java/org/apache/maven/plugin/MojoExecution.java
Modified: maven/components/branches/maven-2.2.0-RC/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.2.0-RC/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=783173&r1=783172&r2=783173&view=diff
==============================================================================
--- maven/components/branches/maven-2.2.0-RC/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java (original)
+++ maven/components/branches/maven-2.2.0-RC/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java Wed Jun 10 01:31:06 2009
@@ -550,8 +550,8 @@
{
// guaranteed to come from the CLI and not be part of a phase
MojoDescriptor mojoDescriptor = getMojoDescriptor( task, session, project, task, true, false );
- executeGoals( Collections.singletonList( new MojoExecution( mojoDescriptor ) ), forkEntryPoints, session,
- project );
+ executeGoals( Collections.singletonList( new MojoExecution( mojoDescriptor, MojoExecution.CLI_EXECUTION_ID ) ),
+ forkEntryPoints, session, project );
}
private void executeGoals( List goals, Stack forkEntryPoints, MavenSession session, MavenProject project )
@@ -624,7 +624,7 @@
{
forkEntryPoints.push( mojoDescriptor );
- forkLifecycle( mojoDescriptor, forkEntryPoints, session, project );
+ forkLifecycle( mojoDescriptor, forkEntryPoints, session, project, mojoExecution.getExecutionId() );
forkEntryPoints.pop();
}
@@ -644,7 +644,7 @@
{
forkEntryPoints.push( descriptor );
- forkLifecycle( descriptor, forkEntryPoints, session, project );
+ forkLifecycle( descriptor, forkEntryPoints, session, project, forkedExecution.getExecutionId() );
forkEntryPoints.pop();
}
@@ -930,8 +930,21 @@
{
id = reportSet.getId();
}
+ else
+ {
+ id = mojoExecution.getExecutionId();
+ }
+
+ MojoExecution reportExecution;
+ if ( id.startsWith( MojoExecution.DEFAULT_EXEC_ID_PREFIX ) )
+ {
+ reportExecution = new MojoExecution( mojoDescriptor );
+ }
+ else
+ {
+ reportExecution = new MojoExecution( mojoDescriptor, id );
+ }
- MojoExecution reportExecution = new MojoExecution( mojoDescriptor, id );
reports.add( reportExecution );
}
}
@@ -983,7 +996,7 @@
}
private void forkLifecycle( MojoDescriptor mojoDescriptor, Stack ancestorLifecycleForkers, MavenSession session,
- MavenProject project )
+ MavenProject project, String executionId )
throws LifecycleExecutionException, BuildFailureException, PluginNotFoundException
{
PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
@@ -1001,17 +1014,17 @@
line();
- forkProjectLifecycle( mojoDescriptor, ancestorLifecycleForkers, session, reactorProject );
+ forkProjectLifecycle( mojoDescriptor, ancestorLifecycleForkers, session, reactorProject, executionId );
}
}
else
{
- forkProjectLifecycle( mojoDescriptor, ancestorLifecycleForkers, session, project );
+ forkProjectLifecycle( mojoDescriptor, ancestorLifecycleForkers, session, project, executionId );
}
}
private void forkProjectLifecycle( MojoDescriptor mojoDescriptor, Stack forkEntryPoints, MavenSession session,
- MavenProject project )
+ MavenProject project, String executionId )
throws LifecycleExecutionException, BuildFailureException, PluginNotFoundException
{
project = project.getExecutionProject();
@@ -1128,7 +1141,16 @@
}
MojoDescriptor desc = getMojoDescriptor( lifecyclePluginDescriptor, lifecycleGoal );
- MojoExecution mojoExecution = new MojoExecution( desc, configuration );
+ MojoExecution mojoExecution;
+ if ( executionId.startsWith( MojoExecution.DEFAULT_EXEC_ID_PREFIX ) )
+ {
+ mojoExecution = new MojoExecution( desc, configuration );
+ }
+ else
+ {
+ mojoExecution = new MojoExecution( desc, configuration, executionId );
+ }
+
addToLifecycleMappings( lifecycleMappings, phase.getId(), mojoExecution,
session.getSettings() );
}
@@ -1171,7 +1193,7 @@
{
String goal = mojoDescriptor.getExecuteGoal();
MojoDescriptor desc = getMojoDescriptor( pluginDescriptor, goal );
- executeGoals( Collections.singletonList( new MojoExecution( desc ) ), forkEntryPoints, session, project );
+ executeGoals( Collections.singletonList( new MojoExecution( desc, goal ) ), forkEntryPoints, session, project );
}
}
Modified: maven/components/branches/maven-2.2.0-RC/maven-core/src/main/java/org/apache/maven/plugin/MojoExecution.java
URL: http://svn.apache.org/viewvc/maven/components/branches/maven-2.2.0-RC/maven-core/src/main/java/org/apache/maven/plugin/MojoExecution.java?rev=783173&r1=783172&r2=783173&view=diff
==============================================================================
--- maven/components/branches/maven-2.2.0-RC/maven-core/src/main/java/org/apache/maven/plugin/MojoExecution.java (original)
+++ maven/components/branches/maven-2.2.0-RC/maven-core/src/main/java/org/apache/maven/plugin/MojoExecution.java Wed Jun 10 01:31:06 2009
@@ -33,9 +33,13 @@
*/
public class MojoExecution
{
+ public static final String DEFAULT_EXEC_ID_PREFIX = "default-";
+
+ public static final String CLI_EXECUTION_ID = DEFAULT_EXEC_ID_PREFIX + "cli";
+
// Execution ID needs to default to "default" to allow configuration of that execution alongside
// other executions.
- private String executionId = "default";
+ private final String executionId;
private final MojoDescriptor mojoDescriptor;
@@ -49,6 +53,7 @@
{
this.mojoDescriptor = mojoDescriptor;
this.configuration = null;
+ this.executionId = DEFAULT_EXEC_ID_PREFIX + mojoDescriptor.getGoal();
}
public MojoExecution( MojoDescriptor mojoDescriptor, String executionId )
@@ -62,6 +67,14 @@
{
this.mojoDescriptor = mojoDescriptor;
this.configuration = configuration;
+ this.executionId = DEFAULT_EXEC_ID_PREFIX + mojoDescriptor.getGoal();
+ }
+
+ public MojoExecution( MojoDescriptor mojoDescriptor, Xpp3Dom configuration, String executionId )
+ {
+ this.mojoDescriptor = mojoDescriptor;
+ this.configuration = configuration;
+ this.executionId = executionId;
}
public String getExecutionId()