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 2007/03/16 16:37:31 UTC

svn commit: r519011 - in /maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main: java/org/apache/maven/execution/ java/org/apache/maven/lifecycle/ java/org/apache/maven/lifecycle/plan/ java/org/apache/maven/lifecycle/statemgmt/ java/org/...

Author: jdcasey
Date: Fri Mar 16 08:37:30 2007
New Revision: 519011

URL: http://svn.apache.org/viewvc?view=rev&rev=519011
Log:
updated javadocs on remaining changes for the lifecycle refactor.

Modified:
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionContext.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/BuildPlan.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecycleBuildPlan.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecyclePlannerException.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/ModifiablePlanElement.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/ReportingPlanModifier.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/SubLifecycleBuildPlan.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/statemgmt/StateManagementUtils.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/loader/DefaultPluginLoader.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/loader/PluginLoader.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/loader/PluginLoaderException.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/resources/META-INF/plexus/components.xml

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java?view=diff&rev=519011&r1=519010&r2=519011
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java Fri Mar 16 08:37:30 2007
@@ -21,15 +21,12 @@
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.monitor.event.EventDispatcher;
-import org.apache.maven.plugin.descriptor.MojoDescriptor;
 import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.project.MavenProject;
-import org.apache.maven.reporting.MavenReport;
 import org.apache.maven.settings.Settings;
 import org.codehaus.plexus.PlexusContainer;
 import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
 
-import java.util.ArrayList;
 import java.util.Date;
 import java.util.LinkedHashMap;
 import java.util.List;
@@ -163,20 +160,4 @@
         return request;
     }
     
-    // this is a hack to try to untangle Maven's reporting system from the lifecycle executor, 
-    // so we can plan the lifecycle steps ahead of any actual execution.
-    public List getReports()
-    {
-        return new ArrayList( reports.values() );
-    }
-    
-    public void clearReports()
-    {
-        reports.clear();
-    }
-
-    public void addReport( MojoDescriptor mojoDescriptor, MavenReport report )
-    {
-        reports.put( mojoDescriptor.getId(), report );
-    }
 }

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionContext.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionContext.java?view=diff&rev=519011&r1=519010&r2=519011
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionContext.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionContext.java Fri Mar 16 08:37:30 2007
@@ -3,12 +3,25 @@
 import org.apache.maven.context.BuildContext;
 import org.apache.maven.context.BuildContextManager;
 import org.apache.maven.context.ManagedBuildData;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
 import org.apache.maven.project.MavenProject;
+import org.apache.maven.reporting.MavenReport;
 
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Stack;
 
+/**
+ * Build context that contains the current project used by the executing mojo, plus any parent
+ * project instances (not inheritance-wise, but fork-wise) in a stack that will be restored once the
+ * current forked-execution is completed. This class also tracks the reports executed for a project,
+ * for future reference by other mojos using the ${reports} expression.
+ * 
+ * @author jdcasey
+ *
+ */
 public class LifecycleExecutionContext
     implements ManagedBuildData
 {
@@ -17,9 +30,12 @@
     
     private static final String CURRENT_PROJECT_KEY = "current-project";
     private static final String PROJECT_STACK_KEY = "fork-project-stack";
+    private static final String REPORTS_KEY = "reports";
     
     private MavenProject currentProject;
     private Stack forkedProjectStack = new Stack();
+
+    private Map reports;
     
     public LifecycleExecutionContext( MavenProject project )
     {
@@ -31,31 +47,54 @@
         // used for retrieval.
     }
 
+    /**
+     * Serialize the data in this context for storage. Any class in maven-core or the bootclasspath is legal
+     * here as a datatype in the data map.
+     */
     public Map getData()
     {
         Map data = new HashMap();
         data.put( CURRENT_PROJECT_KEY, currentProject );
         data.put( PROJECT_STACK_KEY, forkedProjectStack );
+        data.put( REPORTS_KEY, reports );
         
         return data;
     }
 
+    /**
+     * Retrieve the master key under which the serialized data map for this context will be stored
+     * in the main {@link BuildContext}.
+     */
     public String getStorageKey()
     {
         return BUILD_CONTEXT_KEY;
     }
 
+    /**
+     * Deserialize the data for this context. Any class in maven-core or the bootclasspath is legal
+     * here as a datatype in the data map.
+     */
     public void setData( Map data )
     {
         this.currentProject = (MavenProject) data.get( CURRENT_PROJECT_KEY );
         this.forkedProjectStack = (Stack) data.get( PROJECT_STACK_KEY );
+        this.reports = (Map) data.get( REPORTS_KEY );
     }
     
+    /**
+     * Push the existing currentProject onto the forked-project stack, and set the specified project
+     * as the new current project. This signifies the beginning of a new forked-execution context.
+     */
     public void addForkedProject( MavenProject project )
     {
-        forkedProjectStack.push( project );
+        forkedProjectStack.push( currentProject );
+        currentProject = project;
     }
     
+    /**
+     * Peel off the last forked project from the stack, and restore it as the currentProject. This
+     * signifies the cleanup of a completed forked-execution context.
+     */
     public MavenProject removeForkedProject()
     {
         if ( !forkedProjectStack.isEmpty() )
@@ -69,11 +108,18 @@
         return null;
     }
     
+    /**
+     * Return the current project for use in a mojo execution.
+     */
     public MavenProject getCurrentProject()
     {
         return currentProject;
     }
     
+    /**
+     * Convenience method to read the current context instance out of the main {@link BuildContext} provided
+     * by the specified {@link BuildContextManager}. If no current context exist, return null.
+     */
     public static LifecycleExecutionContext read( BuildContextManager buildContextManager )
     {
         BuildContext buildContext = buildContextManager.readBuildContext( true );
@@ -87,6 +133,10 @@
         return null;
     }
     
+    /**
+     * Remove the current lifecycle context from the main {@link BuildContext} provided by the
+     * specified {@link BuildContextManager}.
+     */
     public static void delete( BuildContextManager buildContextManager )
     {
         BuildContext buildContext = buildContextManager.readBuildContext( false );
@@ -97,6 +147,10 @@
         }
     }
     
+    /**
+     * Store this lifecycle context in the main {@link BuildContext} provided by the specified
+     * {@link BuildContextManager}.
+     */
     public void store( BuildContextManager buildContextManager )
     {
         BuildContext buildContext = buildContextManager.readBuildContext( true );
@@ -104,4 +158,30 @@
         buildContextManager.storeBuildContext( buildContext );
     }
 
+    /**
+     * Retrieve the list of reports ({@link MavenReport} instances) that have been executed against
+     * this project, for use in another mojo's execution.
+     */
+    public List getReports()
+    {
+        return new ArrayList( reports.values() );
+    }
+    
+    /**
+     * Clear the reports for this project
+     */
+    public void clearReports()
+    {
+        reports.clear();
+    }
+
+    /**
+     * Add a newly-executed report ({@link MavenReport} instance) to the reports collection, for 
+     * future reference.
+     */
+    public void addReport( MojoDescriptor mojoDescriptor, MavenReport report )
+    {
+        reports.put( mojoDescriptor.getId(), report );
+    }
+    
 }

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/BuildPlan.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/BuildPlan.java?view=diff&rev=519011&r1=519010&r2=519011
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/BuildPlan.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/BuildPlan.java Fri Mar 16 08:37:30 2007
@@ -8,7 +8,7 @@
 import java.util.List;
 
 public interface BuildPlan
-    extends ModifiablePlanElement, DirectInvocationOriginElement
+    extends ModifiablePlanElement
 {
 
     List getPlanMojoBindings(MavenProject project, LifecycleBindingManager bindingManager)

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecycleBuildPlan.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecycleBuildPlan.java?view=diff&rev=519011&r1=519010&r2=519011
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecycleBuildPlan.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecycleBuildPlan.java Fri Mar 16 08:37:30 2007
@@ -12,8 +12,19 @@
 import java.util.List;
 import java.util.Map;
 
+/**
+ * Construct a list of MojoBinding instances that accomplish all of the tasks specified. For lifecycle
+ * phases, construct a list of mojos to execute up to and including the specified phase, and add them
+ * to the list. For direct invocations, construct a new MojoBinding instance and add it to the list.
+ * 
+ * All of these bindings are subject to lifecycle modifications due to forking, reporting, or other
+ * factors, and also to forked-execution modification of direct invocations.
+ * 
+ * @author jdcasey
+ *
+ */
 public class LifecycleBuildPlan
-    implements BuildPlan
+    implements BuildPlan, DirectInvocationOriginElement
 {
 
     private final List tasks;
@@ -30,6 +41,10 @@
         this.lifecycleBindings = lifecycleBindings;
     }
 
+    /**
+     * Build the master execution list necessary to accomplish the specified tasks, given the
+     * specified set of mojo bindings to different parts of the lifecycle.
+     */
     public List getPlanMojoBindings( MavenProject project, LifecycleBindingManager bindingManager )
         throws LifecycleSpecificationException, LifecyclePlannerException, LifecycleLoaderException
     {
@@ -38,21 +53,36 @@
         return bindingManager.assembleMojoBindingList( tasks, cloned, directInvocationModifiers, project );
     }
 
+    /**
+     * Retrieve the set of tasks that this build plan is responsible for.
+     */
     public List getTasks()
     {
         return tasks;
     }
 
+    /**
+     * Add a new build-plan modifier to inject reporting, forked-execution, or other altered behavior
+     * into the "vanilla" lifecycle that was specified at instance construction.
+     */
     public void addModifier( BuildPlanModifier planModifier )
     {
         planModifiers.add( planModifier );
     }
 
+    /**
+     * Return true if build-plan modifiers exist (these are lifecycle-only modifiers, not direct
+     * invocation modifiers).
+     */
     public boolean hasModifiers()
     {
         return !planModifiers.isEmpty();
     }
 
+    /**
+     * Add a new modifier for a direct-invocation MojoBinding in the build plan resulting from this
+     * instance.
+     */
     public void addDirectInvocationModifier( DirectInvocationModifier modifier )
     {
         directInvocationModifiers.put( LifecycleUtils.createMojoBindingKey( modifier.getBindingToModify(), true ), modifier );

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecyclePlannerException.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecyclePlannerException.java?view=diff&rev=519011&r1=519010&r2=519011
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecyclePlannerException.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecyclePlannerException.java Fri Mar 16 08:37:30 2007
@@ -2,6 +2,12 @@
 
 import org.apache.maven.lifecycle.LifecycleException;
 
+/**
+ * Signals an error during build-plan construction.
+ * 
+ * @author jdcasey
+ *
+ */
 public class LifecyclePlannerException
     extends LifecycleException
 {

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/ModifiablePlanElement.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/ModifiablePlanElement.java?view=diff&rev=519011&r1=519010&r2=519011
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/ModifiablePlanElement.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/ModifiablePlanElement.java Fri Mar 16 08:37:30 2007
@@ -1,11 +1,23 @@
 package org.apache.maven.lifecycle.plan;
 
-
+/**
+ * Any element of a build plan that contains or handles a LifecycleBindings instance which is subject
+ * to modification.
+ *  
+ * @author jdcasey
+ *
+ */
 public interface ModifiablePlanElement
 {
 
+    /**
+     * Add a new lifecycle modifier to this build-plan element.
+     */
     void addModifier( BuildPlanModifier planModifier );
 
+    /**
+     * Return true if this element has lifecycle modifiers
+     */
     boolean hasModifiers();
     
 }

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/ReportingPlanModifier.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/ReportingPlanModifier.java?view=diff&rev=519011&r1=519010&r2=519011
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/ReportingPlanModifier.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/ReportingPlanModifier.java Fri Mar 16 08:37:30 2007
@@ -9,6 +9,13 @@
 import java.util.Iterator;
 import java.util.List;
 
+/**
+ * Inject the MojoBindings necessary to execute and make available the report instances that another
+ * mojo in the build plan needs.
+ * 
+ * @author jdcasey
+ *
+ */
 public class ReportingPlanModifier
     implements BuildPlanModifier
 {
@@ -23,6 +30,10 @@
         this.reportBindings = reportBindings;
     }
 
+    /**
+     * Find the mojo that requested reports, and inject the reporting MojoBinding instances just
+     * ahead of it in the lifecycle bindings.
+     */
     public LifecycleBindings modifyBindings( LifecycleBindings bindings )
         throws LifecyclePlannerException
     {
@@ -64,11 +75,17 @@
         return bindings;
     }
 
+    /**
+     * Add further lifecycle modifications to this report-injecting modifier.
+     */
     public void addModifier( BuildPlanModifier planModifier )
     {
         planModifiers.add( planModifier );
     }
 
+    /**
+     * Return true if this report-injecting modifier contains further modifications for the lifecycle.
+     */
     public boolean hasModifiers()
     {
         return !planModifiers.isEmpty();

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/SubLifecycleBuildPlan.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/SubLifecycleBuildPlan.java?view=diff&rev=519011&r1=519010&r2=519011
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/SubLifecycleBuildPlan.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/SubLifecycleBuildPlan.java Fri Mar 16 08:37:30 2007
@@ -6,25 +6,65 @@
 import org.apache.maven.lifecycle.model.LifecycleBindings;
 import org.apache.maven.project.MavenProject;
 
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
+/**
+ * Constructs a build plan using a LifecycleBindings instance, but only allowing one phase for that
+ * lifecycle, as opposed to the parent class which allows a list of tasks (some of which may not be
+ * lifecycle phases at all).
+ * 
+ * This build plan cannot produce direct-invocation MojoBindings.
+ * 
+ * @author jdcasey
+ *
+ */
 public class SubLifecycleBuildPlan
-    extends LifecycleBuildPlan
+    implements BuildPlan
 {
     
+    private LifecycleBuildPlan delegate;
+    private final String phase;
+    
     public SubLifecycleBuildPlan( String phase, LifecycleBindings bindings )
     {
-        super( Collections.singletonList( phase ), bindings );
+        this.phase = phase;
+        delegate = new LifecycleBuildPlan( Collections.singletonList( phase ), bindings );
     }
 
+    /**
+     * Retrieve the build plan binding list from the delegate {@link LifecycleBuildPlan} instance,
+     * and return them.
+     */
     public List getPlanMojoBindings(MavenProject project, LifecycleBindingManager bindingManager)
         throws LifecycleSpecificationException, LifecyclePlannerException, LifecycleLoaderException
     {
-        List bindings = new ArrayList( super.getPlanMojoBindings(project, bindingManager) );
-        
-        return bindings;
+        return delegate.getPlanMojoBindings(project, bindingManager);
+    }
+
+    /**
+     * Return a list containing a single item: the lifecycle phase that this plan is concerned with
+     * accomplishing.
+     */
+    public List getTasks()
+    {
+        return Collections.singletonList( phase );
+    }
+
+    /**
+     * Add a build-plan modifier to the delegate {@link LifecycleBuildPlan} instance.
+     */
+    public void addModifier( BuildPlanModifier planModifier )
+    {
+        delegate.addModifier( planModifier );
+    }
+
+    /**
+     * Return true if the delegate {@link LifecycleBuildPlan} instance contains build-plan modifiers.
+     */
+    public boolean hasModifiers()
+    {
+        return delegate.hasModifiers();
     }
 
 }

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/statemgmt/StateManagementUtils.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/statemgmt/StateManagementUtils.java?view=diff&rev=519011&r1=519010&r2=519011
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/statemgmt/StateManagementUtils.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/statemgmt/StateManagementUtils.java Fri Mar 16 08:37:30 2007
@@ -3,6 +3,13 @@
 import org.apache.maven.lifecycle.model.MojoBinding;
 import org.codehaus.plexus.util.xml.Xpp3Dom;
 
+/**
+ * Constructs and matches MojoBinding instances that refer to the forked-execution context manager
+ * mojos.
+ * 
+ * @author jdcasey
+ *
+ */
 public final class StateManagementUtils
 {
 
@@ -26,6 +33,11 @@
     {
     }
 
+    /**
+     * Create a new MojoBinding instance that refers to the internal mojo used to setup a new 
+     * forked-execution context. Also, set the configuration to contain the forkId for this new
+     * context.
+     */
     public static MojoBinding createStartForkedExecutionMojoBinding()
     {
         MojoBinding binding = new MojoBinding();
@@ -49,6 +61,11 @@
         return binding;
     }
 
+    /**
+     * Create a new MojoBinding instance that refers to the internal mojo used to end a 
+     * forked-execution context. Also, set the configuration to contain the forkId for this new
+     * context.
+     */
     public static MojoBinding createEndForkedExecutionMojoBinding()
     {
         MojoBinding binding = new MojoBinding();
@@ -70,6 +87,11 @@
         return binding;
     }
 
+    /**
+     * Create a new MojoBinding instance that refers to the internal mojo used to cleanup a completed 
+     * forked-execution context. Also, set the configuration to contain the forkId for this new
+     * context.
+     */
     public static MojoBinding createClearForkedExecutionMojoBinding()
     {
         MojoBinding binding = new MojoBinding();
@@ -91,18 +113,33 @@
         return binding;
     }
     
+    /**
+     * Return true if the specified MojoBinding refers to the internal mojo used to setup a new
+     * forked-execution context. This is useful for formatting when listing the build plan, when
+     * expression of these actual mojo names isn't necessarily useful, and can be confusing.
+     */
     public static boolean isForkedExecutionStartMarker( MojoBinding binding )
     {
         return GROUP_ID.equals( binding.getGroupId() ) && ARTIFACT_ID.equals( binding.getArtifactId() )
             && START_FORKED_EXECUTION_GOAL.equals( binding.getGoal() );
     }
 
+    /**
+     * Return true if the specified MojoBinding refers to the internal mojo used to end a
+     * forked-execution context. This is useful for formatting when listing the build plan, when
+     * expression of these actual mojo names isn't necessarily useful, and can be confusing.
+     */
     public static boolean isForkedExecutionEndMarker( MojoBinding binding )
     {
         return GROUP_ID.equals( binding.getGroupId() ) && ARTIFACT_ID.equals( binding.getArtifactId() )
             && END_FORKED_EXECUTION_GOAL.equals( binding.getGoal() );
     }
 
+    /**
+     * Return true if the specified MojoBinding refers to the internal mojo used to clean up a completed
+     * forked-execution context. This is useful for formatting when listing the build plan, when
+     * expression of these actual mojo names isn't necessarily useful, and can be confusing.
+     */
     public static boolean isForkedExecutionClearMarker( MojoBinding binding )
     {
         return GROUP_ID.equals( binding.getGroupId() ) && ARTIFACT_ID.equals( binding.getArtifactId() )

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?view=diff&rev=519011&r1=519010&r2=519011
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java Fri Mar 16 08:37:30 2007
@@ -36,8 +36,10 @@
 import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
 import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
 import org.apache.maven.artifact.versioning.VersionRange;
+import org.apache.maven.context.BuildContextManager;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.execution.RuntimeInformation;
+import org.apache.maven.lifecycle.LifecycleExecutionContext;
 import org.apache.maven.lifecycle.statemgmt.StateManagementUtils;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.model.ReportPlugin;
@@ -131,6 +133,8 @@
 
     protected PluginMappingManager pluginMappingManager;
 
+    private BuildContextManager buildContextManager;
+
     // END component requirements
 
     public DefaultPluginManager()
@@ -610,9 +614,18 @@
 
             plugin.execute();
             
+            // NEW: If the mojo that just executed is a report, store it in the LifecycleExecutionContext
+            // for reference by future mojos.
             if ( plugin instanceof MavenReport )
             {
-                session.addReport( mojoDescriptor, (MavenReport) plugin );
+                LifecycleExecutionContext ctx = LifecycleExecutionContext.read( buildContextManager );
+                if ( ctx == null )
+                {
+                    ctx = new LifecycleExecutionContext( project );
+                }
+                
+                ctx.addReport( mojoDescriptor, (MavenReport) plugin );
+                ctx.store( buildContextManager );
             }
             
             container.setLookupRealm( oldRealm );
@@ -786,9 +799,16 @@
         //            PlexusConfiguration mergedConfiguration = mergeConfiguration( pomConfiguration,
         //                                                                          mojoDescriptor.getConfiguration() );
 
-        ExpressionEvaluator expressionEvaluator = new PluginParameterExpressionEvaluator( session, mojoExecution,
-                                                                                          pathTranslator, getLogger(),
-                                                                                          project,
+        // NEW: Pass in the LifecycleExecutionContext so we have access to the current project, 
+        // forked project stack (future), and reports.
+        LifecycleExecutionContext ctx = LifecycleExecutionContext.read( buildContextManager );
+        if ( ctx == null )
+        {
+            ctx = new LifecycleExecutionContext( project );
+        }
+        
+        ExpressionEvaluator expressionEvaluator = new PluginParameterExpressionEvaluator( session, mojoExecution, pathTranslator,
+                                                                                          ctx, getLogger(),
                                                                                           session.getExecutionProperties() );
 
         PlexusConfiguration extractedMojoConfiguration =

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java?view=diff&rev=519011&r1=519010&r2=519011
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterExpressionEvaluator.java Fri Mar 16 08:37:30 2007
@@ -20,6 +20,7 @@
  */
 
 import org.apache.maven.execution.MavenSession;
+import org.apache.maven.lifecycle.LifecycleExecutionContext;
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
 import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.project.MavenProject;
@@ -74,6 +75,49 @@
 
     private final Properties properties;
 
+    private final LifecycleExecutionContext lifecycleExecutionContext;
+
+    public PluginParameterExpressionEvaluator( MavenSession context,
+                                               MojoExecution mojoExecution,
+                                               PathTranslator pathTranslator,
+                                               LifecycleExecutionContext lifecycleExecutionContext,
+                                               Logger logger,
+                                               Properties properties )
+    {
+        this.context = context;
+        this.mojoExecution = mojoExecution;
+        this.pathTranslator = pathTranslator;
+        this.lifecycleExecutionContext = lifecycleExecutionContext;
+        this.logger = logger;
+        this.properties = properties;
+        
+        this.project = lifecycleExecutionContext.getCurrentProject();
+
+        String basedir = null;
+
+        if ( project != null )
+        {
+            File projectFile = project.getFile();
+
+            // this should always be the case for non-super POM instances...
+            if ( projectFile != null )
+            {
+                basedir = projectFile.getParentFile().getAbsolutePath();
+            }
+        }
+
+        if ( basedir == null )
+        {
+            basedir = System.getProperty( "user.dir" );
+        }
+
+        this.basedir = basedir;
+    }
+
+    /**
+     * @deprecated Use {@link PluginParameterExpressionEvaluator#PluginParameterExpressionEvaluator(MavenSession, MojoExecution, PathTranslator, LifecycleExecutionContext, Logger, Properties)}
+     * instead.
+     */
     public PluginParameterExpressionEvaluator( MavenSession context,
                                                MojoExecution mojoExecution,
                                                PathTranslator pathTranslator,
@@ -84,9 +128,11 @@
         this.context = context;
         this.mojoExecution = mojoExecution;
         this.pathTranslator = pathTranslator;
+        this.lifecycleExecutionContext = new LifecycleExecutionContext( project );
         this.logger = logger;
-        this.project = project;
         this.properties = properties;
+        
+        this.project = project;
 
         String basedir = null;
 
@@ -192,7 +238,7 @@
         }
         else if ( "reports".equals( expression ) )
         {
-            value = context.getReports();
+            value = lifecycleExecutionContext.getReports();
         }
         else if ( "project".equals( expression ) )
         {

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/loader/DefaultPluginLoader.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/loader/DefaultPluginLoader.java?view=diff&rev=519011&r1=519010&r2=519011
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/loader/DefaultPluginLoader.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/loader/DefaultPluginLoader.java Fri Mar 16 08:37:30 2007
@@ -1,5 +1,6 @@
 package org.apache.maven.plugin.loader;
 
+import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
@@ -19,12 +20,20 @@
 import org.apache.maven.plugin.version.PluginVersionResolutionException;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.settings.Settings;
+import org.codehaus.classworlds.ClassRealm;
 import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
 import org.codehaus.plexus.logging.LogEnabled;
 import org.codehaus.plexus.logging.Logger;
 
 import java.util.Iterator;
 
+/**
+ * Responsible for loading plugins, reports, and any components contained therein. Will resolve
+ * plugin versions and plugin prefixes as necessary for plugin resolution.
+ * 
+ * @author jdcasey
+ *
+ */
 public class DefaultPluginLoader
     implements PluginLoader, LogEnabled
 {
@@ -40,6 +49,10 @@
 
     private MavenPluginCollector pluginCollector;
 
+    /**
+     * Lookup a component with the specified role + roleHint in the plugin's {@link ClassRealm}.
+     * Load the plugin first.
+     */
     public Object loadPluginComponent( String role, String roleHint, Plugin plugin, MavenProject project )
         throws ComponentLookupException, PluginLoaderException
     {
@@ -84,11 +97,16 @@
         }
     }
 
+    /**
+     * Load the {@link PluginDescriptor} instance for the plugin implied by the specified MojoBinding, 
+     * using the project for {@link ArtifactRepository} and other supplemental plugin information as 
+     * necessary.
+     */
     public PluginDescriptor loadPlugin( MojoBinding mojoBinding, MavenProject project )
         throws PluginLoaderException
     {
         PluginDescriptor pluginDescriptor = null;
-        
+
         Plugin plugin = new Plugin();
         plugin.setGroupId( mojoBinding.getGroupId() );
         plugin.setArtifactId( mojoBinding.getArtifactId() );
@@ -106,42 +124,63 @@
 
         return pluginDescriptor;
     }
-    
+
+    /**
+     * Determine the appropriate {@link PluginDescriptor} instance for use with the specified plugin
+     * prefix, using the following strategies (in order):
+     * <br/>
+     * <ol>
+     *   <li>Search for a plugin that has already been loaded with the specified prefix</li>
+     *   <li>Search for a plugin configured in the POM that has a matching prefix</li>
+     *   <li>Search the pluginGroups specified in the settings.xml for a matching plugin</li>
+     *   <li>Use groupId == org.apache.maven.plugins, and artifactId == maven-&lt;prefix&gt;-plugin,
+     *         and try to resolve based on that.</li>
+     * </ol>
+     */
     public PluginDescriptor findPluginForPrefix( String prefix, MavenProject project )
         throws PluginLoaderException
     {
-        PluginDescriptor pluginDescriptor = loadByPrefix( prefix, project );
+        PluginDescriptor pluginDescriptor = pluginCollector.getPluginDescriptorForPrefix( prefix );
 
         if ( pluginDescriptor == null )
         {
             pluginDescriptor = loadFromProject( prefix, project );
         }
-            
+
+        if ( pluginDescriptor == null )
+        {
+            pluginDescriptor = loadByPrefix( prefix, project );
+        }
+
         if ( pluginDescriptor == null )
         {
             Plugin plugin = new Plugin();
             plugin.setArtifactId( PluginDescriptor.getDefaultPluginArtifactId( prefix ) );
-            
+
             pluginDescriptor = loadPlugin( plugin, project );
         }
-        
+
         if ( pluginDescriptor == null )
         {
             throw new PluginLoaderException( "Cannot find plugin with prefix: " + prefix );
         }
-        
+
         return pluginDescriptor;
     }
 
+    /**
+     * Look for a plugin configured in the current project that has a prefix matching the one
+     * specified. Return the {@link PluginDescriptor} if a match is found.
+     */
     private PluginDescriptor loadFromProject( String prefix, MavenProject project )
         throws PluginLoaderException
     {
         PluginDescriptor result = null;
-        
+
         for ( Iterator it = project.getBuildPlugins().iterator(); it.hasNext(); )
         {
             Plugin plugin = (Plugin) it.next();
-            
+
             PluginDescriptor pluginDescriptor = loadPlugin( plugin, project );
             if ( prefix.equals( pluginDescriptor.getGoalPrefix() ) )
             {
@@ -149,32 +188,36 @@
                 break;
             }
         }
-        
+
         return result;
     }
 
+    /**
+     * Look for a plugin in the pluginGroups specified in the settings.xml that has a prefix 
+     * matching the one specified. Return the {@link PluginDescriptor} if a match is found.
+     */
     private PluginDescriptor loadByPrefix( String prefix, MavenProject project )
         throws PluginLoaderException
     {
-        PluginDescriptor pluginDescriptor = pluginCollector.getPluginDescriptorForPrefix( prefix );
-        
         SessionContext ctx = SessionContext.read( buildContextManager );
         Settings settings = ctx.getSettings();
-        
-        if ( pluginDescriptor == null )
+
+        Plugin plugin = pluginMappingManager.getByPrefix( prefix, settings.getPluginGroups(),
+                                                          project.getPluginArtifactRepositories(), ctx.getLocalRepository() );
+
+        PluginDescriptor pluginDescriptor = null;
+        if ( plugin != null )
         {
-            Plugin plugin = pluginMappingManager.getByPrefix( prefix, settings.getPluginGroups(),
-                                                       project.getPluginArtifactRepositories(), ctx.getLocalRepository() );
-            
-            if ( plugin != null )
-            {
-                pluginDescriptor = loadPlugin( plugin, project );
-            }
+            pluginDescriptor = loadPlugin( plugin, project );
         }
-        
+
         return pluginDescriptor;
     }
 
+    /**
+     * Load the {@link PluginDescriptor} instance for the specified plugin, using the project for
+     * the {@link ArtifactRepository} and other supplemental plugin information as necessary.
+     */
     public PluginDescriptor loadPlugin( Plugin plugin, MavenProject project )
         throws PluginLoaderException
     {
@@ -182,17 +225,17 @@
         {
             plugin.setGroupId( PluginDescriptor.getDefaultPluginGroupId() );
         }
-        
+
         SessionContext ctx = SessionContext.read( buildContextManager );
 
         try
         {
             PluginDescriptor result = pluginManager.verifyPlugin( plugin, project, ctx.getSession() );
-            
+
             // this has been simplified from the old code that injected the plugin management stuff, since
             // pluginManagement injection is now handled by the project method.
             project.addPlugin( plugin );
-            
+
             return result;
         }
         catch ( ArtifactResolutionException e )
@@ -234,6 +277,11 @@
         this.logger = logger;
     }
 
+    /**
+     * Load the {@link PluginDescriptor} instance for the report plugin implied by the specified MojoBinding, 
+     * using the project for {@link ArtifactRepository} and other supplemental report/plugin information as 
+     * necessary.
+     */
     public PluginDescriptor loadReportPlugin( MojoBinding mojoBinding, MavenProject project )
         throws PluginLoaderException
     {
@@ -249,11 +297,15 @@
         return pluginDescriptor;
     }
 
+    /**
+     * Load the {@link PluginDescriptor} instance for the specified report plugin, using the project for
+     * the {@link ArtifactRepository} and other supplemental report/plugin information as necessary.
+     */
     public PluginDescriptor loadReportPlugin( ReportPlugin plugin, MavenProject project )
         throws PluginLoaderException
     {
         // TODO: Shouldn't we be injecting pluginManagement info here??
-        
+
         SessionContext ctx = SessionContext.read( buildContextManager );
 
         try

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/loader/PluginLoader.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/loader/PluginLoader.java?view=diff&rev=519011&r1=519010&r2=519011
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/loader/PluginLoader.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/loader/PluginLoader.java Fri Mar 16 08:37:30 2007
@@ -1,30 +1,73 @@
 package org.apache.maven.plugin.loader;
 
+import org.apache.maven.artifact.repository.ArtifactRepository;
 import org.apache.maven.lifecycle.model.MojoBinding;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.model.ReportPlugin;
 import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.project.MavenProject;
+import org.codehaus.classworlds.ClassRealm;
 import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
 
+/**
+ * Responsible for loading plugins, reports, and any components contained therein. Will resolve
+ * plugin versions and plugin prefixes as necessary for plugin resolution.
+ * 
+ * @author jdcasey
+ *
+ */
 public interface PluginLoader
 {
 
+    /**
+     * Lookup a component with the specified role + roleHint in the plugin's {@link ClassRealm}.
+     * Load the plugin first.
+     */
     Object loadPluginComponent( String role, String roleHint, Plugin plugin, MavenProject project )
         throws ComponentLookupException, PluginLoaderException;
 
+    /**
+     * Load the {@link PluginDescriptor} instance for the specified plugin, using the project for
+     * the {@link ArtifactRepository} and other supplemental plugin information as necessary.
+     */
     PluginDescriptor loadPlugin( Plugin plugin, MavenProject project )
         throws PluginLoaderException;
 
+    /**
+     * Load the {@link PluginDescriptor} instance for the plugin implied by the specified MojoBinding, 
+     * using the project for {@link ArtifactRepository} and other supplemental plugin information as 
+     * necessary.
+     */
     PluginDescriptor loadPlugin( MojoBinding mojoBinding, MavenProject project )
         throws PluginLoaderException;
 
+    /**
+     * Load the {@link PluginDescriptor} instance for the specified report plugin, using the project for
+     * the {@link ArtifactRepository} and other supplemental report/plugin information as necessary.
+     */
     PluginDescriptor loadReportPlugin( ReportPlugin reportPlugin, MavenProject project )
         throws PluginLoaderException;
 
+    /**
+     * Load the {@link PluginDescriptor} instance for the report plugin implied by the specified MojoBinding, 
+     * using the project for {@link ArtifactRepository} and other supplemental report/plugin information as 
+     * necessary.
+     */
     PluginDescriptor loadReportPlugin( MojoBinding mojoBinding, MavenProject project )
         throws PluginLoaderException;
 
+    /**
+     * Determine the appropriate {@link PluginDescriptor} instance for use with the specified plugin
+     * prefix, using the following strategies (in order):
+     * <br/>
+     * <ol>
+     *   <li>Search for a plugin that has already been loaded with the specified prefix</li>
+     *   <li>Search for a plugin configured in the POM that has a matching prefix</li>
+     *   <li>Search the pluginGroups specified in the settings.xml for a matching plugin</li>
+     *   <li>Use groupId == org.apache.maven.plugins, and artifactId == maven-&lt;prefix&gt;-plugin,
+     *         and try to resolve based on that.</li>
+     * </ol>
+     */
     PluginDescriptor findPluginForPrefix( String prefix, MavenProject project )
         throws PluginLoaderException;
     

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/loader/PluginLoaderException.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/loader/PluginLoaderException.java?view=diff&rev=519011&r1=519010&r2=519011
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/loader/PluginLoaderException.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/plugin/loader/PluginLoaderException.java Fri Mar 16 08:37:30 2007
@@ -3,6 +3,13 @@
 import org.apache.maven.model.Plugin;
 import org.apache.maven.model.ReportPlugin;
 
+/**
+ * Signifies a failure to load a plugin. This is used to abstract the specific errors which may be
+ * encountered at lower levels, and provide a dependable interface to the plugin-loading framework.
+ * 
+ * @author jdcasey
+ *
+ */
 public class PluginLoaderException
     extends Exception
 {

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/resources/META-INF/plexus/components.xml?view=diff&rev=519011&r1=519010&r2=519011
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/resources/META-INF/plexus/components.xml (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/resources/META-INF/plexus/components.xml Fri Mar 16 08:37:30 2007
@@ -53,6 +53,9 @@
       <implementation>org.apache.maven.plugin.DefaultPluginManager</implementation>
       <requirements>
         <requirement>
+          <role>org.apache.maven.context.BuildContextManager</role>
+        </requirement>
+        <requirement>
           <role>org.apache.maven.ArtifactFilterManager</role>
         </requirement>
         <requirement>