maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdca...@apache.org
Subject svn commit: r518461 [1/2] - in /maven/components/branches/2.1-lifecycle-refactor: ./ maven-core/src/main/java/org/apache/maven/lifecycle/ maven-core/src/main/java/org/apache/maven/lifecycle/binding/ maven-core/src/main/java/org/apache/maven/lifecycle/p...
Date Thu, 15 Mar 2007 03:52:57 GMT
Author: jdcasey
Date: Wed Mar 14 20:52:55 2007
New Revision: 518461

URL: http://svn.apache.org/viewvc?view=rev&rev=518461
Log:
Fixing integration tests...should be two or three outstanding failures, but most work.

Added:
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionContext.java   (with props)
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/BindingUtils.java   (with props)
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultMojoBindingFactory.java   (with props)
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/LegacyLifecycleMappingParser.java
      - copied, changed from r518177, maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/LegacyLifecycleMappingParser.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/MojoBindingFactory.java   (with props)
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/statemgmt/ClearForkedContextMojo.java   (with props)
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/test/java/org/apache/maven/lifecycle/binding/DefaultMojoBindingFactoryTest.java   (with props)
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/test/java/org/apache/maven/lifecycle/plan/LifecycleBuildPlanTest.java
      - copied, changed from r517868, maven/components/branches/2.1-lifecycle-refactor/maven-core/src/test/java/org/apache/maven/lifecycle/plan/DefaultLifecyclePlanTest.java
Removed:
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/LegacyLifecycleMappingParser.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/test/java/org/apache/maven/lifecycle/plan/BuildPlanUtilsTest.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/test/java/org/apache/maven/lifecycle/plan/DefaultLifecyclePlanTest.java
    maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/PrefixedMojoBinding.java
    maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/test/java/org/apache/maven/lifecycle/MojoBindingUtilsTest.java
Modified:
    maven/components/branches/2.1-lifecycle-refactor/build.xml
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultLifecycleBindingManager.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/LifecycleBindingManager.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/BuildPlanUtils.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DefaultBuildPlanner.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DirectInvocationPlan.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/ForkPlanModifier.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/ForkedLifecycleBuildPlan.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/statemgmt/EndForkedExecutionMojo.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/statemgmt/StartForkedExecutionMojo.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/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/resources/META-INF/maven/plugin.xml
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/resources/META-INF/plexus/components.xml
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/test/java/org/apache/maven/lifecycle/LegacyLifecycleMappingParserTest.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/test/java/org/apache/maven/lifecycle/binding/DefaultLifecycleBindingManagerTest.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/test/java/org/apache/maven/lifecycle/plan/ForkPlanModifierTest.java
    maven/components/branches/2.1-lifecycle-refactor/maven-embedder/src/test/java/org/apache/maven/embedder/AbstractEmbedderExecutionTestCase.java
    maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/LifecycleUtils.java
    maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/MojoBindingUtils.java
    maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/test/java/org/apache/maven/lifecycle/LifecycleUtilsTest.java
    maven/components/branches/2.1-lifecycle-refactor/maven-project/src/main/java/org/apache/maven/project/MavenProject.java

Modified: maven/components/branches/2.1-lifecycle-refactor/build.xml
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/build.xml?view=diff&rev=518461&r1=518460&r2=518461
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/build.xml (original)
+++ maven/components/branches/2.1-lifecycle-refactor/build.xml Wed Mar 14 20:52:55 2007
@@ -288,11 +288,11 @@
 
     <java fork="true" classname="org.apache.maven.cli.MavenCli" failonerror="true">
       <classpath refid="maven.classpath"/>
+<!--
       <arg value="-e"/>
+ -->
       <arg value="-B"/>
-<!--
       <arg value="-X"/>
- -->
       <arg value="clean"/>
       <arg value="install"/>
     </java>
@@ -342,7 +342,10 @@
       </classpath>
       <sysproperty key="classworlds.conf" value="${bootstrapDir}/m2.conf"/>
       <sysproperty key="bootstrapDir" value="${bootstrapDir}"/>
+      <arg value="-X"/>
+<!-- 
       <arg value="-e"/>
+ -->
       <arg line="${maven.goals}"/>
     </java>
 

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?view=diff&rev=518461&r1=518460&r2=518461
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java Wed Mar 14 20:52:55 2007
@@ -25,8 +25,11 @@
 import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
+import org.apache.maven.context.BuildContextManager;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.execution.ReactorManager;
+import org.apache.maven.lifecycle.binding.LifecycleBindingManager;
+import org.apache.maven.lifecycle.binding.MojoBindingFactory;
 import org.apache.maven.lifecycle.model.MojoBinding;
 import org.apache.maven.lifecycle.plan.BuildPlan;
 import org.apache.maven.lifecycle.plan.BuildPlanUtils;
@@ -84,6 +87,12 @@
 
     private ArtifactHandlerManager artifactHandlerManager;
 
+    private MojoBindingFactory mojoBindingFactory;
+
+    private LifecycleBindingManager lifecycleBindingManager;
+
+    private BuildContextManager buildContextManager;
+
     // ----------------------------------------------------------------------
     //
     // ----------------------------------------------------------------------
@@ -169,6 +178,9 @@
 
                     dispatcher.dispatchStart( event, target );
 
+                    LifecycleExecutionContext ctx = new LifecycleExecutionContext( rootProject );
+                    ctx.store( buildContextManager );
+                    
                     List mojoBindings = getLifecycleBindings( segment.getTasks(), rootProject, target );
                     
                     // only call once, with the top-level project (assumed to be provided as a parameter)...
@@ -176,10 +188,12 @@
                     {
                         MojoBinding binding = (MojoBinding) mojoIterator.next();
 
-                        executeGoalAndHandleFailures( binding, session, rootProject, dispatcher, event, rm, buildStartTime,
+                        executeGoalAndHandleFailures( binding, session, dispatcher, event, rm, buildStartTime,
                                                       target );
                     }
-
+                    
+                    LifecycleExecutionContext.delete( buildContextManager );
+                    
                     rm.registerBuildSuccess( rootProject, System.currentTimeMillis() - buildStartTime );
 
                     dispatcher.dispatchEnd( event, target );
@@ -226,6 +240,9 @@
                         long buildStartTime = System.currentTimeMillis();
 
                         dispatcher.dispatchStart( event, target );
+                        
+                        LifecycleExecutionContext ctx = new LifecycleExecutionContext( currentProject );
+                        ctx.store( buildContextManager );
 
                         List mojoBindings = getLifecycleBindings( segment.getTasks(), currentProject, target );
                         
@@ -233,10 +250,13 @@
                         {
                             MojoBinding mojoBinding = (MojoBinding) mojoIterator.next();
 
-                            executeGoalAndHandleFailures( mojoBinding, session, currentProject, dispatcher, event, rm,
+                            getLogger().debug( "Mojo: " + mojoBinding.getGoal() + " has config:\n" + mojoBinding.getConfiguration() );
+                            executeGoalAndHandleFailures( mojoBinding, session, dispatcher, event, rm,
                                                           buildStartTime, target );
                         }
 
+                        LifecycleExecutionContext.delete( buildContextManager );
+                        
                         rm.registerBuildSuccess( currentProject, System.currentTimeMillis() - buildStartTime );
 
                         dispatcher.dispatchEnd( event, target );
@@ -269,10 +289,10 @@
             
             if ( getLogger().isDebugEnabled() )
             {
-                getLogger().debug( "\n\nOur build plan is:\n" + BuildPlanUtils.listBuildPlan( plan ) + "\n\n" );
+                getLogger().debug( "\n\nOur build plan is:\n" + BuildPlanUtils.listBuildPlan( plan, project, lifecycleBindingManager, false ) + "\n\n" );
             }
             
-            mojoBindings = plan.getPlanMojoBindings();
+            mojoBindings = plan.getPlanMojoBindings( project, lifecycleBindingManager );
         }
         catch ( LifecycleException e )
         {
@@ -283,11 +303,13 @@
         return mojoBindings;
     }
 
-    private void executeGoalAndHandleFailures( MojoBinding mojoBinding, MavenSession session, MavenProject project,
-                                               EventDispatcher dispatcher, String event, ReactorManager rm,
+    private void executeGoalAndHandleFailures( MojoBinding mojoBinding, MavenSession session, EventDispatcher dispatcher, String event, ReactorManager rm,
                                                long buildStartTime, String target )
         throws BuildFailureException, LifecycleExecutionException
     {
+        LifecycleExecutionContext ctx = LifecycleExecutionContext.read( buildContextManager );
+        MavenProject project = ctx.getCurrentProject();
+        
         try
         {
             PluginDescriptor pluginDescriptor = null;
@@ -446,6 +468,12 @@
                         
                         throw new BuildFailureException( message, e );
                     }
+                    catch ( LifecycleLoaderException e )
+                    {
+                        String message = "Cannot find plugin to match task '" + task + "'.";
+                    
+                        throw new BuildFailureException( message, e );
+                    }
 
                     // if the mojo descriptor was found, determine aggregator status according to:
                     // 1. whether the mojo declares itself an aggregator
@@ -594,9 +622,9 @@
     }
 
     private MojoDescriptor getMojoDescriptorForDirectInvocation( String task, MavenSession session, MavenProject project )
-        throws LifecycleSpecificationException, PluginLoaderException
+        throws LifecycleSpecificationException, PluginLoaderException, LifecycleLoaderException
     {
-        MojoBinding binding = MojoBindingUtils.parseMojoBinding( task, true );
+        MojoBinding binding = mojoBindingFactory.parseMojoBinding( task, project, true );
         
         PluginDescriptor descriptor = pluginLoader.loadPlugin( binding, project );
         MojoDescriptor mojoDescriptor = descriptor.getMojo( binding.getGoal() );

Added: 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=auto&rev=518461
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionContext.java (added)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionContext.java Wed Mar 14 20:52:55 2007
@@ -0,0 +1,107 @@
+package org.apache.maven.lifecycle;
+
+import org.apache.maven.context.BuildContext;
+import org.apache.maven.context.BuildContextManager;
+import org.apache.maven.context.ManagedBuildData;
+import org.apache.maven.project.MavenProject;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Stack;
+
+public class LifecycleExecutionContext
+    implements ManagedBuildData
+{
+    
+    public static final String BUILD_CONTEXT_KEY = LifecycleExecutionContext.class.getName();
+    
+    private static final String CURRENT_PROJECT_KEY = "current-project";
+    private static final String PROJECT_STACK_KEY = "fork-project-stack";
+    
+    private MavenProject currentProject;
+    private Stack forkedProjectStack = new Stack();
+    
+    public LifecycleExecutionContext( MavenProject project )
+    {
+        this.currentProject = project;
+    }
+    
+    private LifecycleExecutionContext()
+    {
+        // used for retrieval.
+    }
+
+    public Map getData()
+    {
+        Map data = new HashMap();
+        data.put( CURRENT_PROJECT_KEY, currentProject );
+        data.put( PROJECT_STACK_KEY, forkedProjectStack );
+        
+        return data;
+    }
+
+    public String getStorageKey()
+    {
+        return BUILD_CONTEXT_KEY;
+    }
+
+    public void setData( Map data )
+    {
+        this.currentProject = (MavenProject) data.get( CURRENT_PROJECT_KEY );
+        this.forkedProjectStack = (Stack) data.get( PROJECT_STACK_KEY );
+    }
+    
+    public void addForkedProject( MavenProject project )
+    {
+        forkedProjectStack.push( project );
+    }
+    
+    public MavenProject removeForkedProject()
+    {
+        if ( !forkedProjectStack.isEmpty() )
+        {
+            MavenProject lastCurrent = currentProject;
+            currentProject = (MavenProject) forkedProjectStack.pop();
+            
+            return lastCurrent;
+        }
+        
+        return null;
+    }
+    
+    public MavenProject getCurrentProject()
+    {
+        return currentProject;
+    }
+    
+    public static LifecycleExecutionContext read( BuildContextManager buildContextManager )
+    {
+        BuildContext buildContext = buildContextManager.readBuildContext( true );
+        
+        LifecycleExecutionContext ctx = new LifecycleExecutionContext();
+        if ( buildContext.retrieve( ctx ) )
+        {
+            return ctx;
+        }
+        
+        return null;
+    }
+    
+    public static void delete( BuildContextManager buildContextManager )
+    {
+        BuildContext buildContext = buildContextManager.readBuildContext( false );
+        
+        if ( buildContext != null )
+        {
+            buildContext.delete( BUILD_CONTEXT_KEY );
+        }
+    }
+    
+    public void store( BuildContextManager buildContextManager )
+    {
+        BuildContext buildContext = buildContextManager.readBuildContext( true );
+        buildContext.store( this );
+        buildContextManager.storeBuildContext( buildContext );
+    }
+
+}

Propchange: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutionContext.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Added: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/BindingUtils.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/BindingUtils.java?view=auto&rev=518461
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/BindingUtils.java (added)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/BindingUtils.java Wed Mar 14 20:52:55 2007
@@ -0,0 +1,203 @@
+package org.apache.maven.lifecycle.binding;
+
+import org.apache.maven.lifecycle.model.LifecycleBinding;
+import org.apache.maven.lifecycle.model.LifecycleBindings;
+import org.apache.maven.lifecycle.model.MojoBinding;
+import org.apache.maven.lifecycle.model.Phase;
+import org.apache.maven.model.Build;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.PluginContainer;
+import org.apache.maven.model.PluginExecution;
+import org.apache.maven.model.PluginManagement;
+import org.apache.maven.model.ReportPlugin;
+import org.apache.maven.model.ReportSet;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ModelUtils;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+final class BindingUtils
+{
+
+    static Map buildPluginMap( MavenProject project )
+    {
+        Map pluginMap = new HashMap();
+        
+        if ( project != null )
+        {
+            Build build = project.getBuild();
+            if ( build != null )
+            {
+                for ( Iterator it = build.getPlugins().iterator(); it.hasNext(); )
+                {
+                    Plugin plugin = (Plugin) it.next();
+
+                    pluginMap.put( createPluginKey( plugin ), plugin );
+                }
+            }
+        }
+
+        return pluginMap;
+    }
+
+    static Map buildPluginMap( PluginContainer pluginContainer )
+    {
+        Map pluginMap = new HashMap();
+        
+        if ( pluginContainer != null )
+        {
+            for ( Iterator it = pluginContainer.getPlugins().iterator(); it.hasNext(); )
+            {
+                Plugin plugin = (Plugin) it.next();
+
+                pluginMap.put( createPluginKey( plugin ), plugin );
+            }
+        }
+
+        return pluginMap;
+    }
+
+    static String createPluginKey( Plugin plugin )
+    {
+        return createPluginKey( plugin.getGroupId(), plugin.getArtifactId() );
+    }
+
+    static String createPluginKey( String groupId, String artifactId )
+    {
+        return ( groupId == null ? PluginDescriptor.getDefaultPluginGroupId() : groupId ) + ":" + artifactId;
+    }
+
+    static Object mergeConfigurations( ReportPlugin reportPlugin, ReportSet reportSet )
+    {
+        return mergeRawConfigurations( reportSet.getConfiguration(), reportPlugin.getConfiguration() );
+    }
+
+    static Object mergeConfigurations( Plugin plugin, PluginExecution execution )
+    {
+        if ( plugin == null && execution == null )
+        {
+            return null;
+        }
+        else if ( execution == null )
+        {
+            return plugin.getConfiguration();
+        }
+        else if ( plugin == null )
+        {
+            return execution.getConfiguration();
+        }
+        else
+        {
+            return mergeRawConfigurations( execution.getConfiguration(), plugin.getConfiguration() );
+        }
+    }
+
+    static Object mergeRawConfigurations( Object dominant, Object recessive )
+    {
+        Xpp3Dom dominantConfig = (Xpp3Dom) dominant;
+        Xpp3Dom recessiveConfig = (Xpp3Dom) recessive;
+
+        if ( recessiveConfig == null )
+        {
+            return dominantConfig;
+        }
+        else if ( dominantConfig == null )
+        {
+            return recessiveConfig;
+        }
+        else
+        {
+            return Xpp3Dom.mergeXpp3Dom( new Xpp3Dom( dominantConfig ), recessiveConfig );
+        }
+    }
+    
+    static void injectProjectConfiguration( MojoBinding binding, MavenProject project )
+    {
+        Map pluginMap = buildPluginMap( project );
+        Plugin plugin = (Plugin) pluginMap.get( createPluginKey( binding.getGroupId(), binding.getArtifactId() ) );
+
+        if ( plugin == null )
+        {
+            plugin = new Plugin();
+            plugin.setGroupId( binding.getGroupId() );
+            plugin.setArtifactId( binding.getArtifactId() );
+        }
+        
+        injectPluginManagementInfo( plugin, project );
+
+        PluginExecution exec = (PluginExecution) plugin.getExecutionsAsMap().get( binding.getExecutionId() );
+
+        binding.setConfiguration( mergeConfigurations( plugin, exec ) );
+    }
+
+    static void injectProjectConfiguration( LifecycleBindings bindings, MavenProject project )
+    {
+        Map pluginsByVersionlessKey = buildPluginMap( project );
+
+        for ( Iterator lifecycleIt = bindings.getBindingList().iterator(); lifecycleIt.hasNext(); )
+        {
+            LifecycleBinding binding = (LifecycleBinding) lifecycleIt.next();
+
+            for ( Iterator phaseIt = binding.getPhasesInOrder().iterator(); phaseIt.hasNext(); )
+            {
+                Phase phase = (Phase) phaseIt.next();
+
+                for ( Iterator mojoIt = phase.getBindings().iterator(); mojoIt.hasNext(); )
+                {
+                    MojoBinding mojo = (MojoBinding) mojoIt.next();
+
+                    String pluginKey = createPluginKey( mojo.getGroupId(), mojo.getArtifactId() );
+                    Plugin plugin = (Plugin) pluginsByVersionlessKey.get( pluginKey );
+
+                    if ( plugin == null )
+                    {
+                        plugin = new Plugin();
+                        plugin.setGroupId( mojo.getGroupId() );
+                        plugin.setArtifactId( mojo.getArtifactId() );
+                    }
+                    
+                    injectPluginManagementInfo( plugin, project );
+
+                    PluginExecution exec = (PluginExecution) plugin.getExecutionsAsMap().get( mojo.getExecutionId() );
+
+                    mojo.setConfiguration( mergeConfigurations( plugin, exec ) );
+                }
+            }
+        }
+    }
+
+    static void injectPluginManagementInfo( Plugin plugin, MavenProject project )
+    {
+        if ( project == null )
+        {
+            return;
+        }
+        
+        Build build = project.getBuild();
+        if ( build == null )
+        {
+            return;
+        }
+        
+        PluginManagement plugMgmt = build.getPluginManagement();
+        if ( plugMgmt == null )
+        {
+            return;
+        }
+        
+        Map plugMgmtMap = buildPluginMap( plugMgmt );
+        
+        String key = createPluginKey( plugin );
+        Plugin mgmtPlugin = (Plugin) plugMgmtMap.get( key );
+        
+        if ( mgmtPlugin != null )
+        {
+            ModelUtils.mergePluginDefinitions( plugin, mgmtPlugin, false );
+        }
+    }
+
+}

Propchange: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/BindingUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/BindingUtils.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultLifecycleBindingManager.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultLifecycleBindingManager.java?view=diff&rev=518461&r1=518460&r2=518461
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultLifecycleBindingManager.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultLifecycleBindingManager.java Wed Mar 14 20:52:55 2007
@@ -1,14 +1,15 @@
 package org.apache.maven.lifecycle.binding;
 
-import org.apache.maven.lifecycle.LegacyLifecycleMappingParser;
 import org.apache.maven.lifecycle.LifecycleBindingLoader;
 import org.apache.maven.lifecycle.LifecycleLoaderException;
 import org.apache.maven.lifecycle.LifecycleSpecificationException;
 import org.apache.maven.lifecycle.LifecycleUtils;
-import org.apache.maven.lifecycle.MojoBindingUtils;
 import org.apache.maven.lifecycle.mapping.LifecycleMapping;
+import org.apache.maven.lifecycle.model.LifecycleBinding;
 import org.apache.maven.lifecycle.model.LifecycleBindings;
 import org.apache.maven.lifecycle.model.MojoBinding;
+import org.apache.maven.lifecycle.plan.BuildPlan;
+import org.apache.maven.lifecycle.plan.LifecyclePlannerException;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.model.PluginExecution;
 import org.apache.maven.model.ReportPlugin;
@@ -29,8 +30,10 @@
 
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 import java.util.StringTokenizer;
 
 //FIXME: This needs a better name!
@@ -44,6 +47,10 @@
 
     private PluginLoader pluginLoader;
 
+    private MojoBindingFactory mojoBindingFactory;
+    
+    private LegacyLifecycleMappingParser legacyLifecycleMappingParser;
+
     private Logger logger;
 
     // configured. Moved out of DefaultLifecycleExecutor...
@@ -71,7 +78,7 @@
             LifecycleMapping mapping = (LifecycleMapping) legacyMappingsByPackaging.get( packaging );
             if ( mapping != null )
             {
-                bindings = LegacyLifecycleMappingParser.parseMappings( mapping, packaging );
+                bindings = legacyLifecycleMappingParser.parseMappings( mapping, packaging );
             }
         }
 
@@ -79,10 +86,14 @@
         {
             bindings = searchPluginsWithExtensions( project );
         }
+        else
+        {
+            BindingUtils.injectProjectConfiguration( bindings, project );
+        }
 
         if ( bindings == null )
         {
-            bindings = getDefaultBindings();
+            bindings = getDefaultBindings( project );
         }
 
         return bindings;
@@ -146,7 +157,7 @@
 
                     if ( mapping != null )
                     {
-                        bindings = LegacyLifecycleMappingParser.parseMappings( mapping, packaging );
+                        bindings = legacyLifecycleMappingParser.parseMappings( mapping, packaging );
                     }
                 }
 
@@ -157,13 +168,22 @@
             }
         }
 
+        if ( bindings != null )
+        {
+            BindingUtils.injectProjectConfiguration( bindings, project );
+        }
+
         return bindings;
     }
 
-    public LifecycleBindings getDefaultBindings()
+    public LifecycleBindings getDefaultBindings( MavenProject project )
         throws LifecycleSpecificationException
     {
-        return LegacyLifecycleMappingParser.parseDefaultMappings( legacyLifecycles );
+        LifecycleBindings bindings = legacyLifecycleMappingParser.parseDefaultMappings( legacyLifecycles );
+
+        BindingUtils.injectProjectConfiguration( bindings, project );
+
+        return bindings;
     }
 
     public void enableLogging( Logger logger )
@@ -185,6 +205,8 @@
             for ( Iterator it = plugins.iterator(); it.hasNext(); )
             {
                 Plugin plugin = (Plugin) it.next();
+                BindingUtils.injectPluginManagementInfo( plugin, project );
+
                 PluginDescriptor pluginDescriptor = null;
 
                 List executions = plugin.getExecutions();
@@ -205,7 +227,7 @@
                             mojoBinding.setArtifactId( plugin.getArtifactId() );
                             mojoBinding.setVersion( plugin.getVersion() );
                             mojoBinding.setGoal( goal );
-                            mojoBinding.setConfiguration( execution.getConfiguration() );
+                            mojoBinding.setConfiguration( BindingUtils.mergeConfigurations( plugin, execution ) );
                             mojoBinding.setExecutionId( execution.getId() );
                             mojoBinding.setOrigin( "POM" );
 
@@ -247,7 +269,8 @@
         return bindings;
     }
 
-    public LifecycleBindings getPluginLifecycleOverlay( PluginDescriptor pluginDescriptor, String lifecycleId )
+    public LifecycleBindings getPluginLifecycleOverlay( PluginDescriptor pluginDescriptor, String lifecycleId,
+                                                        MavenProject project )
         throws LifecycleLoaderException, LifecycleSpecificationException
     {
         Lifecycle lifecycleOverlay = null;
@@ -314,7 +337,7 @@
                     MojoBinding binding;
                     if ( goal.indexOf( ":" ) > 0 )
                     {
-                        binding = MojoBindingUtils.parseMojoBinding( goal, false );
+                        binding = mojoBindingFactory.parseMojoBinding( goal, project, false );
                     }
                     else
                     {
@@ -402,7 +425,7 @@
     private List getReportPluginsForProject( MavenProject project )
     {
         List reportPlugins = project.getReportPlugins();
-        
+
         if ( project.getReporting() == null || !project.getReporting().isExcludeDefaults() )
         {
             if ( reportPlugins == null )
@@ -417,7 +440,7 @@
             for ( Iterator i = defaultReports.iterator(); i.hasNext(); )
             {
                 String report = (String) i.next();
-                
+
                 StringTokenizer tok = new StringTokenizer( report, ":" );
                 if ( tok.countTokens() != 2 )
                 {
@@ -448,7 +471,7 @@
                 }
             }
         }
-        
+
         return reportPlugins;
     }
 
@@ -466,6 +489,9 @@
                 + e.getMessage(), e );
         }
 
+        String pluginKey = BindingUtils.createPluginKey( reportPlugin.getGroupId(), reportPlugin.getArtifactId() );
+        Plugin plugin = (Plugin) BindingUtils.buildPluginMap( project ).get( pluginKey );
+
         List reports = new ArrayList();
         for ( Iterator i = pluginDescriptor.getMojos().iterator(); i.hasNext(); )
         {
@@ -489,9 +515,131 @@
                 binding.setExecutionId( id );
                 binding.setOrigin( "POM" );
 
+                Object reportConfig = BindingUtils.mergeConfigurations( reportPlugin, reportSet );
+
+                if ( plugin == null )
+                {
+                    plugin = new Plugin();
+                    plugin.setGroupId( pluginDescriptor.getGroupId() );
+                    plugin.setArtifactId( pluginDescriptor.getArtifactId() );
+                }
+                
+                BindingUtils.injectPluginManagementInfo( plugin, project );
+
+                Map execMap = plugin.getExecutionsAsMap();
+                PluginExecution exec = (PluginExecution) execMap.get( id );
+
+                Object pluginConfig = plugin.getConfiguration();
+                if ( exec != null )
+                {
+                    pluginConfig = BindingUtils.mergeConfigurations( plugin, exec );
+                }
+
+                reportConfig = BindingUtils.mergeRawConfigurations( reportConfig, pluginConfig );
+
+                binding.setConfiguration( reportConfig );
+
                 reports.add( binding );
             }
         }
         return reports;
     }
+
+    static boolean isSameOrSuperListOfMojoBindings( List superCandidate, List check )
+    {
+        if ( superCandidate == null || check == null )
+        {
+            return false;
+        }
+
+        if ( superCandidate.size() < check.size() )
+        {
+            return false;
+        }
+
+        List superKeys = new ArrayList( superCandidate.size() );
+        for ( Iterator it = superCandidate.iterator(); it.hasNext(); )
+        {
+            MojoBinding binding = (MojoBinding) it.next();
+
+            superKeys.add( LifecycleUtils.createMojoBindingKey( binding, true ) );
+        }
+
+        List checkKeys = new ArrayList( check.size() );
+        for ( Iterator it = check.iterator(); it.hasNext(); )
+        {
+            MojoBinding binding = (MojoBinding) it.next();
+
+            checkKeys.add( LifecycleUtils.createMojoBindingKey( binding, true ) );
+        }
+
+        return superKeys.subList( 0, checkKeys.size() ).equals( checkKeys );
+    }
+
+    public List assembleMojoBindingList( List tasks, LifecycleBindings bindings, MavenProject project )
+        throws LifecycleSpecificationException, LifecyclePlannerException, LifecycleLoaderException
+    {
+        return assembleMojoBindingList( tasks, bindings, Collections.EMPTY_MAP, project );
+    }
+
+    public List assembleMojoBindingList( List tasks, LifecycleBindings lifecycleBindings, Map directInvocationPlans,
+                                                MavenProject project )
+        throws LifecycleSpecificationException, LifecyclePlannerException, LifecycleLoaderException
+    {
+        List planBindings = new ArrayList();
+
+        List lastMojoBindings = null;
+        for ( Iterator it = tasks.iterator(); it.hasNext(); )
+        {
+            String task = (String) it.next();
+
+            LifecycleBinding binding = LifecycleUtils.findLifecycleBindingForPhase( task, lifecycleBindings );
+            if ( binding != null )
+            {
+                List mojoBindings = LifecycleUtils.getMojoBindingListForLifecycle( task, binding );
+
+                // save these so we can reference the originals...
+                List originalMojoBindings = mojoBindings;
+
+                // if these mojo bindings are a superset of the last bindings, only add the difference.
+                if ( isSameOrSuperListOfMojoBindings( mojoBindings, lastMojoBindings ) )
+                {
+                    List revised = new ArrayList( mojoBindings );
+                    revised.removeAll( lastMojoBindings );
+
+                    if ( revised.isEmpty() )
+                    {
+                        continue;
+                    }
+
+                    mojoBindings = revised;
+                }
+
+                planBindings.addAll( mojoBindings );
+                lastMojoBindings = originalMojoBindings;
+            }
+            else
+            {
+                MojoBinding mojoBinding = mojoBindingFactory.parseMojoBinding( task, project, true );
+                BindingUtils.injectProjectConfiguration( mojoBinding, project );
+
+                mojoBinding.setOrigin( "direct invocation" );
+
+                String key = LifecycleUtils.createMojoBindingKey( mojoBinding, true );
+                BuildPlan diPlan = (BuildPlan) directInvocationPlans.get( key );
+
+                if ( diPlan != null )
+                {
+                    planBindings.addAll( diPlan.getPlanMojoBindings( project, this ) );
+                }
+                else
+                {
+                    planBindings.add( mojoBinding );
+                }
+            }
+        }
+
+        return planBindings;
+    }
+
 }

Added: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultMojoBindingFactory.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultMojoBindingFactory.java?view=auto&rev=518461
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultMojoBindingFactory.java (added)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultMojoBindingFactory.java Wed Mar 14 20:52:55 2007
@@ -0,0 +1,114 @@
+package org.apache.maven.lifecycle.binding;
+
+import org.apache.maven.lifecycle.LifecycleLoaderException;
+import org.apache.maven.lifecycle.LifecycleSpecificationException;
+import org.apache.maven.lifecycle.model.MojoBinding;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.plugin.loader.PluginLoader;
+import org.apache.maven.plugin.loader.PluginLoaderException;
+import org.apache.maven.project.MavenProject;
+
+import java.util.StringTokenizer;
+
+public class DefaultMojoBindingFactory
+    implements MojoBindingFactory
+{
+
+    PluginLoader pluginLoader;
+
+    public MojoBinding parseMojoBinding( String bindingSpec, MavenProject project, boolean allowPrefixReference )
+        throws LifecycleSpecificationException, LifecycleLoaderException
+    {
+        StringTokenizer tok = new StringTokenizer( bindingSpec, ":" );
+        int numTokens = tok.countTokens();
+
+        MojoBinding binding = null;
+
+        if ( numTokens == 2 )
+        {
+            if ( !allowPrefixReference )
+            {
+                String msg = "Mapped-prefix lookup of mojos are only supported from direct invocation. "
+                    + "Please use specification of the form groupId:artifactId[:version]:goal instead.";
+
+                throw new LifecycleSpecificationException( msg );
+            }
+
+            String prefix = tok.nextToken();
+
+            PluginDescriptor pluginDescriptor;
+            try
+            {
+                pluginDescriptor = pluginLoader.findPluginForPrefix( prefix, project );
+            }
+            catch ( PluginLoaderException e )
+            {
+                throw new LifecycleLoaderException(
+                                                    "Failed to find plugin for prefix: " + prefix + ". Reason: " + e.getMessage(),
+                                                    e );
+            }
+
+            binding = createMojoBinding( pluginDescriptor.getGroupId(), pluginDescriptor.getArtifactId(),
+                                         pluginDescriptor.getVersion(), tok.nextToken(), project );
+        }
+        else if ( numTokens == 3 || numTokens == 4 )
+        {
+            binding = new MojoBinding();
+
+            String groupId = tok.nextToken();
+            String artifactId = tok.nextToken();
+
+            String version = null;
+            if ( numTokens == 4 )
+            {
+                version = tok.nextToken();
+            }
+
+            String goal = tok.nextToken();
+
+            binding = createMojoBinding( groupId, artifactId, version, goal, project );
+        }
+        else
+        {
+            String message = "Invalid task '" + bindingSpec + "': you must specify a valid lifecycle phase, or"
+                + " a goal in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal";
+
+            throw new LifecycleSpecificationException( message );
+        }
+
+        return binding;
+    }
+
+    public MojoBinding createMojoBinding( String groupId, String artifactId, String version, String goal, MavenProject project )
+    {
+        MojoBinding binding = new MojoBinding();
+
+        binding.setGroupId( groupId );
+        binding.setArtifactId( artifactId );
+        binding.setVersion( version );
+        binding.setGoal( goal );
+
+        BindingUtils.injectProjectConfiguration( binding, project );
+
+        return binding;
+    }
+
+    public MojoBinding parseMojoBinding( String bindingSpec )
+        throws LifecycleSpecificationException
+    {
+        try
+        {
+            return parseMojoBinding( bindingSpec, null, false );
+        }
+        catch ( LifecycleLoaderException e )
+        {
+            IllegalStateException error = new IllegalStateException( e.getMessage()
+                + "\n\nTHIS SHOULD BE IMPOSSIBLE DUE TO THE USAGE OF THE PLUGIN-LOADER." );
+            
+            error.initCause( e );
+            
+            throw error;
+        }
+    }
+
+}

Propchange: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultMojoBindingFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/DefaultMojoBindingFactory.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

Copied: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/LegacyLifecycleMappingParser.java (from r518177, maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/LegacyLifecycleMappingParser.java)
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/LegacyLifecycleMappingParser.java?view=diff&rev=518461&p1=maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/LegacyLifecycleMappingParser.java&r1=518177&p2=maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/LegacyLifecycleMappingParser.java&r2=518461
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/LegacyLifecycleMappingParser.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/LegacyLifecycleMappingParser.java Wed Mar 14 20:52:55 2007
@@ -1,6 +1,7 @@
-package org.apache.maven.lifecycle;
+package org.apache.maven.lifecycle.binding;
 
-import org.apache.maven.lifecycle.binding.LegacyLifecycle;
+import org.apache.maven.lifecycle.LifecycleSpecificationException;
+import org.apache.maven.lifecycle.LifecycleUtils;
 import org.apache.maven.lifecycle.mapping.LifecycleMapping;
 import org.apache.maven.lifecycle.model.BuildBinding;
 import org.apache.maven.lifecycle.model.CleanBinding;
@@ -15,10 +16,14 @@
 import java.util.Map;
 import java.util.StringTokenizer;
 
-public final class LegacyLifecycleMappingParser
+public class LegacyLifecycleMappingParser
 {
 
-    public static LifecycleBindings parseDefaultMappings( List lifecycles )
+    public static final String ROLE = LegacyLifecycleMappingParser.class.getName();
+    
+    private MojoBindingFactory mojoBindingFactory;
+
+    public LifecycleBindings parseDefaultMappings( List lifecycles )
         throws LifecycleSpecificationException
     {
         LifecycleBindings bindings = new LifecycleBindings();
@@ -52,7 +57,7 @@
         return bindings;
     }
 
-    public static LifecycleBindings parseMappings( LifecycleMapping mapping, String packaging )
+    public LifecycleBindings parseMappings( LifecycleMapping mapping, String packaging )
         throws LifecycleSpecificationException
     {
         LifecycleBindings bindings = new LifecycleBindings();
@@ -67,7 +72,7 @@
         return bindings;
     }
     
-    private static BuildBinding parseBuildBindings( Map phases, List optionalKeys )
+    private BuildBinding parseBuildBindings( Map phases, List optionalKeys )
         throws LifecycleSpecificationException
     {
         BuildBinding binding = new BuildBinding();
@@ -102,7 +107,7 @@
         return binding;
     }
 
-    private static CleanBinding parseCleanBindings( Map phaseMappings, List optionalKeys )
+    private CleanBinding parseCleanBindings( Map phaseMappings, List optionalKeys )
         throws LifecycleSpecificationException
     {
         CleanBinding binding = new CleanBinding();
@@ -117,7 +122,7 @@
         return binding;
     }
 
-    private static Phase parsePhaseBindings( String bindingList, List optionalKeys )
+    private Phase parsePhaseBindings( String bindingList, List optionalKeys )
         throws LifecycleSpecificationException
     {
         Phase phase = new Phase();
@@ -128,8 +133,8 @@
             {
                 String rawBinding = tok.nextToken().trim();
 
-                MojoBinding binding = MojoBindingUtils.parseMojoBinding( rawBinding, false );
-                if ( optionalKeys.contains( rawBinding ) )
+                MojoBinding binding = mojoBindingFactory.parseMojoBinding( rawBinding );
+                if ( optionalKeys != null && optionalKeys.contains( rawBinding ) )
                 {
                     binding.setOptional( true );
                 }
@@ -146,7 +151,7 @@
         return phase;
     }
 
-    private static SiteBinding parseSiteBindings( Map phases, List optionalKeys )
+    private SiteBinding parseSiteBindings( Map phases, List optionalKeys )
         throws LifecycleSpecificationException
     {
         SiteBinding binding = new SiteBinding();
@@ -160,10 +165,6 @@
         }
 
         return binding;
-    }
-
-    private LegacyLifecycleMappingParser()
-    {
     }
 
 }

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/LifecycleBindingManager.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/LifecycleBindingManager.java?view=diff&rev=518461&r1=518460&r2=518461
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/LifecycleBindingManager.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/LifecycleBindingManager.java Wed Mar 14 20:52:55 2007
@@ -3,10 +3,12 @@
 import org.apache.maven.lifecycle.LifecycleLoaderException;
 import org.apache.maven.lifecycle.LifecycleSpecificationException;
 import org.apache.maven.lifecycle.model.LifecycleBindings;
+import org.apache.maven.lifecycle.plan.LifecyclePlannerException;
 import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.project.MavenProject;
 
 import java.util.List;
+import java.util.Map;
 
 // FIXME: This needs a better name!
 public interface LifecycleBindingManager
@@ -14,7 +16,7 @@
 
     String ROLE = LifecycleBindingManager.class.getName();
 
-    LifecycleBindings getDefaultBindings()
+    LifecycleBindings getDefaultBindings( MavenProject project )
         throws LifecycleSpecificationException;
 
     LifecycleBindings getBindingsForPackaging( MavenProject project )
@@ -23,9 +25,16 @@
     LifecycleBindings getProjectCustomBindings( MavenProject project )
         throws LifecycleLoaderException, LifecycleSpecificationException;
 
-    LifecycleBindings getPluginLifecycleOverlay( PluginDescriptor pluginDescriptor, String lifecycleId )
+    LifecycleBindings getPluginLifecycleOverlay( PluginDescriptor pluginDescriptor, String lifecycleId, MavenProject project )
         throws LifecycleLoaderException, LifecycleSpecificationException;
 
     List getReportBindings( MavenProject project )
         throws LifecycleLoaderException, LifecycleSpecificationException;
+
+    List assembleMojoBindingList( List tasks, LifecycleBindings bindings, Map directInvocationPlans, MavenProject project )
+        throws LifecycleSpecificationException, LifecyclePlannerException, LifecycleLoaderException;
+
+    List assembleMojoBindingList( List tasks, LifecycleBindings lifecycleBindings, MavenProject project )
+        throws LifecycleSpecificationException, LifecyclePlannerException, LifecycleLoaderException;
+
 }

Added: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/MojoBindingFactory.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/MojoBindingFactory.java?view=auto&rev=518461
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/MojoBindingFactory.java (added)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/MojoBindingFactory.java Wed Mar 14 20:52:55 2007
@@ -0,0 +1,21 @@
+package org.apache.maven.lifecycle.binding;
+
+import org.apache.maven.lifecycle.LifecycleLoaderException;
+import org.apache.maven.lifecycle.LifecycleSpecificationException;
+import org.apache.maven.lifecycle.model.MojoBinding;
+import org.apache.maven.project.MavenProject;
+
+public interface MojoBindingFactory
+{
+
+    String ROLE = MojoBindingFactory.class.getName();
+
+    MojoBinding parseMojoBinding( String bindingSpec, MavenProject project, boolean allowPrefixReference )
+        throws LifecycleSpecificationException, LifecycleLoaderException;
+
+    MojoBinding createMojoBinding( String groupId, String artifactId, String version, String goal, MavenProject project );
+
+    MojoBinding parseMojoBinding( String bindingSpec )
+        throws LifecycleSpecificationException;
+
+}

Propchange: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/MojoBindingFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/binding/MojoBindingFactory.java
------------------------------------------------------------------------------
    svn:keywords = "Author Date Id Revision"

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=518461&r1=518460&r2=518461
==============================================================================
--- 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 Wed Mar 14 20:52:55 2007
@@ -1,7 +1,10 @@
 package org.apache.maven.lifecycle.plan;
 
+import org.apache.maven.lifecycle.LifecycleLoaderException;
 import org.apache.maven.lifecycle.LifecycleSpecificationException;
+import org.apache.maven.lifecycle.binding.LifecycleBindingManager;
 import org.apache.maven.lifecycle.model.MojoBinding;
+import org.apache.maven.project.MavenProject;
 
 import java.util.List;
 
@@ -9,8 +12,8 @@
     extends ModifiablePlanElement
 {
 
-    List getPlanMojoBindings()
-        throws LifecycleSpecificationException, LifecyclePlannerException;
+    List getPlanMojoBindings(MavenProject project, LifecycleBindingManager bindingManager)
+        throws LifecycleSpecificationException, LifecyclePlannerException, LifecycleLoaderException;
 
     void addDirectInvocationPlan( MojoBinding directInvocationBinding, BuildPlan plan );
 

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/BuildPlanUtils.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/BuildPlanUtils.java?view=diff&rev=518461&r1=518460&r2=518461
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/BuildPlanUtils.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/BuildPlanUtils.java Wed Mar 14 20:52:55 2007
@@ -1,18 +1,17 @@
 package org.apache.maven.lifecycle.plan;
 
+import org.apache.maven.lifecycle.LifecycleLoaderException;
 import org.apache.maven.lifecycle.LifecycleSpecificationException;
 import org.apache.maven.lifecycle.LifecycleUtils;
 import org.apache.maven.lifecycle.MojoBindingUtils;
-import org.apache.maven.lifecycle.model.LifecycleBinding;
+import org.apache.maven.lifecycle.binding.LifecycleBindingManager;
 import org.apache.maven.lifecycle.model.LifecycleBindings;
 import org.apache.maven.lifecycle.model.MojoBinding;
 import org.apache.maven.lifecycle.statemgmt.StateManagementUtils;
+import org.apache.maven.project.MavenProject;
 
-import java.util.ArrayList;
-import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
-import java.util.Map;
 
 public final class BuildPlanUtils
 {
@@ -21,69 +20,6 @@
     {
     }
 
-    public static List assembleMojoBindingList( List tasks, LifecycleBindings bindings )
-        throws LifecycleSpecificationException, LifecyclePlannerException
-    {
-        return assembleMojoBindingList( tasks, bindings, Collections.EMPTY_MAP );
-    }
-
-    public static List assembleMojoBindingList( List tasks, LifecycleBindings lifecycleBindings, Map directInvocationPlans )
-        throws LifecycleSpecificationException, LifecyclePlannerException
-    {
-        List planBindings = new ArrayList();
-
-        List lastMojoBindings = null;
-        for ( Iterator it = tasks.iterator(); it.hasNext(); )
-        {
-            String task = (String) it.next();
-
-            LifecycleBinding binding = LifecycleUtils.findLifecycleBindingForPhase( task, lifecycleBindings );
-            if ( binding != null )
-            {
-                List mojoBindings = LifecycleUtils.getMojoBindingListForLifecycle( task, binding );
-
-                // save these so we can reference the originals...
-                List originalMojoBindings = mojoBindings;
-
-                // if these mojo bindings are a superset of the last bindings, only add the difference.
-                if ( isSameOrSuperListOfMojoBindings( mojoBindings, lastMojoBindings ) )
-                {
-                    List revised = new ArrayList( mojoBindings );
-                    revised.removeAll( lastMojoBindings );
-
-                    if ( revised.isEmpty() )
-                    {
-                        continue;
-                    }
-
-                    mojoBindings = revised;
-                }
-
-                planBindings.addAll( mojoBindings );
-                lastMojoBindings = originalMojoBindings;
-            }
-            else
-            {
-                MojoBinding mojoBinding = MojoBindingUtils.parseMojoBinding( task, true );
-                mojoBinding.setOrigin( "direct invocation" );
-
-                String key = LifecycleUtils.createMojoBindingKey( mojoBinding, true );
-                BuildPlan diPlan = (BuildPlan) directInvocationPlans.get( key );
-
-                if ( diPlan != null )
-                {
-                    planBindings.addAll( diPlan.getPlanMojoBindings() );
-                }
-                else
-                {
-                    planBindings.add( mojoBinding );
-                }
-            }
-        }
-
-        return planBindings;
-    }
-
     public static LifecycleBindings modifyPlanBindings( LifecycleBindings bindings, List planModifiers )
         throws LifecyclePlannerException
     {
@@ -110,92 +46,125 @@
         return result;
     }
 
-    public static String listBuildPlan( BuildPlan plan )
-        throws LifecycleSpecificationException, LifecyclePlannerException
+    public static String listBuildPlan( BuildPlan plan, MavenProject project, LifecycleBindingManager lifecycleBindingManager )
+        throws LifecycleSpecificationException, LifecyclePlannerException, LifecycleLoaderException
     {
-        List mojoBindings = plan.getPlanMojoBindings();
+        return listBuildPlan( plan, project, lifecycleBindingManager, false );
+    }
 
-        return listBuildPlan( mojoBindings );
+    public static String listBuildPlan( BuildPlan plan, MavenProject project, LifecycleBindingManager lifecycleBindingManager, boolean extendedInfo )
+        throws LifecycleSpecificationException, LifecyclePlannerException, LifecycleLoaderException
+    {
+        List mojoBindings = plan.getPlanMojoBindings( project, lifecycleBindingManager );
+
+        return listBuildPlan( mojoBindings, extendedInfo );
     }
 
     public static String listBuildPlan( List mojoBindings )
         throws LifecycleSpecificationException, LifecyclePlannerException
     {
+        return listBuildPlan( mojoBindings, false );
+    }
+
+    public static String listBuildPlan( List mojoBindings, boolean extendedInfo )
+        throws LifecycleSpecificationException, LifecyclePlannerException
+    {
         StringBuffer listing = new StringBuffer();
         int indentLevel = 0;
 
+        int counter = 1;
         for ( Iterator it = mojoBindings.iterator(); it.hasNext(); )
         {
             MojoBinding binding = (MojoBinding) it.next();
 
             if ( StateManagementUtils.isForkedExecutionStartMarker( binding ) )
             {
-                lineAndIndent( listing, indentLevel );
-                listing.append( "[fork start] " ).append( formatMojoListing( binding, indentLevel ) );
-                
+                newListingLine( listing, indentLevel, counter );
+                listing.append( "[fork start]" );
+
+                if ( extendedInfo )
+                {
+                    listing.append( ' ' ).append( formatMojoListing( binding, indentLevel, extendedInfo ) );
+                }
+
                 indentLevel++;
             }
             else if ( StateManagementUtils.isForkedExecutionEndMarker( binding ) )
             {
                 indentLevel--;
+
+                newListingLine( listing, indentLevel, counter );
+                listing.append( "[fork cleanup]" );
+
+                if ( extendedInfo )
+                {
+                    listing.append( ' ' ).append( formatMojoListing( binding, indentLevel, extendedInfo ) );
+                }
+            }
+            else if ( StateManagementUtils.isForkedExecutionEndMarker( binding ) )
+            {
+                indentLevel--;
+
+                newListingLine( listing, indentLevel, counter );
+                listing.append( "[fork end]" );
+
+                if ( extendedInfo )
+                {
+                    listing.append( ' ' ).append( formatMojoListing( binding, indentLevel, extendedInfo ) );
+                }
                 
-                lineAndIndent( listing, indentLevel );
-                listing.append( "[fork end] " ).append( formatMojoListing( binding, indentLevel ) );
+                indentLevel++;
             }
             else
             {
-                lineAndIndent( listing, indentLevel );
-                listing.append( formatMojoListing( binding, indentLevel ) );
+                newListingLine( listing, indentLevel, counter );
+                listing.append( formatMojoListing( binding, indentLevel, extendedInfo ) );
             }
+
+            counter++;
         }
 
         return listing.toString();
     }
 
-    private static void lineAndIndent( StringBuffer listing, int indentLevel )
+    private static void newListingLine( StringBuffer listing, int indentLevel, int counter )
     {
         listing.append( '\n' );
-        
+
+        listing.append( counter ).append( "." );
+
         for ( int i = 0; i < indentLevel; i++ )
         {
             listing.append( "  " );
         }
+
+        // adding a minimal offset from the counter (line-number) of the listing.
+        listing.append( ' ' );
+
     }
 
     public static String formatMojoListing( MojoBinding binding, int indentLevel )
     {
-        return MojoBindingUtils.toString( binding ) + " [execution: " + binding.getExecutionId() + "] (origin: " + binding.getOrigin() + ")";
+        return formatMojoListing( binding, indentLevel, false );
     }
 
-    private static boolean isSameOrSuperListOfMojoBindings( List superCandidate, List check )
+    public static String formatMojoListing( MojoBinding binding, int indentLevel, boolean extendedInfo )
     {
-        if ( superCandidate == null || check == null )
-        {
-            return false;
-        }
-
-        if ( superCandidate.size() < check.size() )
-        {
-            return false;
-        }
+        StringBuffer listing = new StringBuffer();
 
-        List superKeys = new ArrayList( superCandidate.size() );
-        for ( Iterator it = superCandidate.iterator(); it.hasNext(); )
-        {
-            MojoBinding binding = (MojoBinding) it.next();
+        listing.append( MojoBindingUtils.toString( binding ) );
+        listing.append( " [executionId: " ).append( binding.getExecutionId() ).append( "]" );
 
-            superKeys.add( LifecycleUtils.createMojoBindingKey( binding, true ) );
-        }
-
-        List checkKeys = new ArrayList( check.size() );
-        for ( Iterator it = check.iterator(); it.hasNext(); )
+        if ( extendedInfo )
         {
-            MojoBinding binding = (MojoBinding) it.next();
-
-            checkKeys.add( LifecycleUtils.createMojoBindingKey( binding, true ) );
+            listing.append( "\nOrigin: " ).append( binding.getOrigin() );
+            listing.append( "\nConfiguration:\n\t" ).append(
+                                                             String.valueOf( binding.getConfiguration() ).replaceAll( "\\n",
+                                                                                                                      "\n\t" ) ).append(
+                                                                                                                                         '\n' );
         }
 
-        return superKeys.subList( 0, checkKeys.size() ).equals( checkKeys );
+        return listing.toString();
     }
 
 }

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DefaultBuildPlanner.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DefaultBuildPlanner.java?view=diff&rev=518461&r1=518460&r2=518461
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DefaultBuildPlanner.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DefaultBuildPlanner.java Wed Mar 14 20:52:55 2007
@@ -5,6 +5,7 @@
 import org.apache.maven.lifecycle.LifecycleUtils;
 import org.apache.maven.lifecycle.MojoBindingUtils;
 import org.apache.maven.lifecycle.binding.LifecycleBindingManager;
+import org.apache.maven.lifecycle.binding.MojoBindingFactory;
 import org.apache.maven.lifecycle.model.LifecycleBindings;
 import org.apache.maven.lifecycle.model.MojoBinding;
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
@@ -30,14 +31,16 @@
 
     private LifecycleBindingManager lifecycleBindingManager;
 
+    private MojoBindingFactory mojoBindingFactory;
+
     public BuildPlan constructLifecyclePlan( List tasks, MavenProject project )
         throws LifecycleLoaderException, LifecycleSpecificationException, LifecyclePlannerException
     {
-        LifecycleBindings defaultBindings = lifecycleBindingManager.getDefaultBindings();
+        LifecycleBindings defaultBindings = lifecycleBindingManager.getDefaultBindings( project );
         LifecycleBindings packagingBindings = lifecycleBindingManager.getBindingsForPackaging( project );
         LifecycleBindings projectBindings = lifecycleBindingManager.getProjectCustomBindings( project );
 
-        LifecycleBindings merged = LifecycleUtils.mergeBindings( packagingBindings, projectBindings, defaultBindings, false, false );
+        LifecycleBindings merged = LifecycleUtils.mergeBindings( packagingBindings, projectBindings, defaultBindings, true, false );
 
         // foreach task, find the binding list from the merged lifecycle-bindings.
         // if the binding list is a super-set of a previous task, forget the previous task/binding
@@ -63,14 +66,14 @@
 
     private void addForkedLifecycleModifiers( ModifiablePlanElement planElement, LifecycleBindings lifecycleBindings,
                                               MavenProject project, List tasks )
-        throws LifecyclePlannerException, LifecycleSpecificationException
+        throws LifecyclePlannerException, LifecycleSpecificationException, LifecycleLoaderException
     {
-        List planBindings = BuildPlanUtils.assembleMojoBindingList( tasks, lifecycleBindings );
-        
+        List planBindings = lifecycleBindingManager.assembleMojoBindingList( tasks, lifecycleBindings, project );
+
         for ( Iterator it = planBindings.iterator(); it.hasNext(); )
         {
             MojoBinding mojoBinding = (MojoBinding) it.next();
-            
+
             PluginDescriptor pluginDescriptor;
             try
             {
@@ -96,8 +99,8 @@
                                                  MavenProject project, List tasks )
         throws LifecyclePlannerException, LifecycleSpecificationException, LifecycleLoaderException
     {
-        List planBindings = BuildPlanUtils.assembleMojoBindingList( tasks, lifecycleBindings );
-        
+        List planBindings = lifecycleBindingManager.assembleMojoBindingList( tasks, lifecycleBindings, project );
+
         for ( Iterator it = planBindings.iterator(); it.hasNext(); )
         {
             MojoBinding mojoBinding = (MojoBinding) it.next();
@@ -122,11 +125,11 @@
             if ( mojoDescriptor.isRequiresReports() )
             {
                 List reportBindings = lifecycleBindingManager.getReportBindings( project );
-                
+
                 BuildPlanModifier modder = new ReportingPlanModifier( mojoBinding, reportBindings );
-                
+
                 planElement.addModifier( modder );
-                
+
                 // NOTE: the first sighting of a mojo requiring reports should satisfy this condition.
                 // therefore, we can break out as soon as we find one.
                 break;
@@ -135,9 +138,9 @@
     }
 
     private void findForkModifiers( MojoBinding mojoBinding, PluginDescriptor pluginDescriptor,
-                                     ModifiablePlanElement planElement, LifecycleBindings mergedBindings, MavenProject project, 
-                                     LinkedList forkingBindings, List tasks )
-        throws LifecyclePlannerException, LifecycleSpecificationException
+                                    ModifiablePlanElement planElement, LifecycleBindings mergedBindings, MavenProject project,
+                                    LinkedList forkingBindings, List tasks )
+        throws LifecyclePlannerException, LifecycleSpecificationException, LifecycleLoaderException
     {
         forkingBindings.addLast( mojoBinding );
 
@@ -146,10 +149,11 @@
             String referencingGoal = mojoBinding.getGoal();
 
             MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( referencingGoal );
-            
+
             if ( mojoDescriptor.getExecuteGoal() != null )
             {
-                recurseSingleMojoFork( mojoBinding, pluginDescriptor, planElement, mergedBindings, project, forkingBindings, tasks );
+                recurseSingleMojoFork( mojoBinding, pluginDescriptor, planElement, mergedBindings, project, forkingBindings,
+                                       tasks );
             }
             else if ( mojoDescriptor.getExecutePhase() != null )
             {
@@ -164,14 +168,14 @@
 
     private void modifyBuildPlanForForkedDirectInvocation( MojoBinding invokedBinding, MojoBinding invokedVia,
                                                            PluginDescriptor pluginDescriptor, ModifiablePlanElement planElement,
-                                                           LifecycleBindings mergedBindings, MavenProject project, 
+                                                           LifecycleBindings mergedBindings, MavenProject project,
                                                            LinkedList forkingBindings, List tasks )
-        throws LifecyclePlannerException, LifecycleSpecificationException
+        throws LifecyclePlannerException, LifecycleSpecificationException, LifecycleLoaderException
     {
         if ( LifecycleUtils.findPhaseForMojoBinding( invokedVia, mergedBindings, true ) != null )
         {
             ForkPlanModifier modifier = new ForkPlanModifier( invokedVia, Collections.singletonList( invokedBinding ) );
-            
+
             forkingBindings.addLast( invokedBinding );
             try
             {
@@ -181,23 +185,24 @@
             {
                 forkingBindings.removeLast();
             }
-            
+
             planElement.addModifier( modifier );
         }
         else if ( planElement instanceof BuildPlan )
         {
             BuildPlan directInvocationPlan = new DirectInvocationPlan( invokedBinding, tasks );
-            
+
             forkingBindings.addLast( invokedBinding );
             try
             {
-                findForkModifiers( invokedBinding, pluginDescriptor, directInvocationPlan, mergedBindings, project, forkingBindings, tasks );
+                findForkModifiers( invokedBinding, pluginDescriptor, directInvocationPlan, mergedBindings, project,
+                                   forkingBindings, tasks );
             }
             finally
             {
                 forkingBindings.removeLast();
             }
-            
+
             // if we don't have further modifications to this single direct invocation, don't weigh
             // things down.
             if ( directInvocationPlan.hasModifiers() || directInvocationPlan.hasDirectInvocationPlans() )
@@ -215,15 +220,16 @@
     private void modifyBuildPlanForForkedLifecycle( MojoBinding mojoBinding, PluginDescriptor pluginDescriptor,
                                                     ModifiablePlanElement planElement, LifecycleBindings bindings,
                                                     MavenProject project, LinkedList forkingBindings, List tasks )
-        throws LifecycleSpecificationException, LifecyclePlannerException
+        throws LifecycleSpecificationException, LifecyclePlannerException, LifecycleLoaderException
     {
         MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( mojoBinding.getGoal() );
         String phase = mojoDescriptor.getExecutePhase();
-        
-        List forkedPhaseBindingList = BuildPlanUtils.assembleMojoBindingList( Collections.singletonList( phase ), bindings );
-        
+
+        List forkedPhaseBindingList = lifecycleBindingManager.assembleMojoBindingList( Collections.singletonList( phase ),
+                                                                                       bindings, project );
+
         ModifiablePlanElement mpe;
-        
+
         // setup the ModifiablePlanElement, into which we'll recurse to find further modifications.
         if ( LifecycleUtils.findPhaseForMojoBinding( mojoBinding, bindings, true ) != null )
         {
@@ -238,14 +244,14 @@
             throw new LifecyclePlannerException( "Mojo: " + MojoBindingUtils.toString( mojoBinding )
                 + " is not bound to the lifecycle; you cannot attach this mojo to a build-plan modifier." );
         }
-            
+
         // recurse, to find further modifications, using the ModifiablePlanElement from above, along
         // with the modified task list (which doesn't contain the direct-invocation task that landed
         // us here...
         for ( Iterator it = forkedPhaseBindingList.iterator(); it.hasNext(); )
         {
             MojoBinding forkedBinding = (MojoBinding) it.next();
-            
+
             PluginDescriptor forkedPluginDescriptor;
             try
             {
@@ -255,10 +261,10 @@
             {
                 throw new LifecyclePlannerException( e.getMessage(), e );
             }
-            
+
             findForkModifiers( forkedBinding, forkedPluginDescriptor, mpe, bindings, project, forkingBindings, tasks );
         }
-        
+
         // now that we've discovered any deeper modifications, add the current MPE to the parent MPE
         // in the appropriate location.
         if ( LifecycleUtils.findPhaseForMojoBinding( mojoBinding, bindings, true ) != null )
@@ -274,14 +280,14 @@
     private void recursePhaseMojoFork( MojoBinding mojoBinding, PluginDescriptor pluginDescriptor,
                                        ModifiablePlanElement planElement, LifecycleBindings mergedBindings, MavenProject project,
                                        LinkedList forkingBindings, List tasks )
-        throws LifecyclePlannerException, LifecycleSpecificationException
+        throws LifecyclePlannerException, LifecycleSpecificationException, LifecycleLoaderException
     {
         String referencingGoal = mojoBinding.getGoal();
 
         MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( referencingGoal );
 
         String phase = mojoDescriptor.getExecutePhase();
-        
+
         if ( phase == null )
         {
             return;
@@ -300,7 +306,7 @@
             LifecycleBindings overlayBindings;
             try
             {
-                overlayBindings = lifecycleBindingManager.getPluginLifecycleOverlay( pluginDescriptor, executeLifecycle );
+                overlayBindings = lifecycleBindingManager.getPluginLifecycleOverlay( pluginDescriptor, executeLifecycle, project );
             }
             catch ( LifecycleLoaderException e )
             {
@@ -322,15 +328,16 @@
     }
 
     private void recurseSingleMojoFork( MojoBinding mojoBinding, PluginDescriptor pluginDescriptor,
-                                        ModifiablePlanElement planElement, LifecycleBindings mergedBindings, MavenProject project, LinkedList forkingBindings, List tasks )
-        throws LifecyclePlannerException, LifecycleSpecificationException
+                                        ModifiablePlanElement planElement, LifecycleBindings mergedBindings,
+                                        MavenProject project, LinkedList forkingBindings, List tasks )
+        throws LifecyclePlannerException, LifecycleSpecificationException, LifecycleLoaderException
     {
         String referencingGoal = mojoBinding.getGoal();
 
         MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( referencingGoal );
 
         String executeGoal = mojoDescriptor.getExecuteGoal();
-        
+
         if ( executeGoal == null )
         {
             return;
@@ -342,14 +349,13 @@
             throw new LifecyclePlannerException( "Mojo: " + executeGoal + " (referenced by: " + referencingGoal
                 + ") does not exist in plugin: " + pluginDescriptor.getId() + "." );
         }
-        
-        MojoBinding binding = new MojoBinding();
-        binding.setGroupId( pluginDescriptor.getGroupId() );
-        binding.setArtifactId( pluginDescriptor.getArtifactId() );
-        binding.setVersion( pluginDescriptor.getVersion() );
-        binding.setGoal( executeGoal );
+
+        MojoBinding binding = mojoBindingFactory.createMojoBinding( pluginDescriptor.getGroupId(),
+                                                                    pluginDescriptor.getArtifactId(),
+                                                                    pluginDescriptor.getVersion(), executeGoal, project );
+
         binding.setOrigin( "Forked from " + referencingGoal );
-        
+
         if ( !LifecycleUtils.isMojoBindingPresent( binding, forkingBindings, false ) )
         {
             modifyBuildPlanForForkedDirectInvocation( binding, mojoBinding, pluginDescriptor, planElement, mergedBindings,

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DirectInvocationPlan.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DirectInvocationPlan.java?view=diff&rev=518461&r1=518460&r2=518461
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DirectInvocationPlan.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DirectInvocationPlan.java Wed Mar 14 20:52:55 2007
@@ -1,9 +1,12 @@
 package org.apache.maven.lifecycle.plan;
 
+import org.apache.maven.lifecycle.LifecycleLoaderException;
 import org.apache.maven.lifecycle.LifecycleSpecificationException;
 import org.apache.maven.lifecycle.LifecycleUtils;
+import org.apache.maven.lifecycle.binding.LifecycleBindingManager;
 import org.apache.maven.lifecycle.model.LifecycleBindings;
 import org.apache.maven.lifecycle.model.MojoBinding;
+import org.apache.maven.project.MavenProject;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -32,22 +35,22 @@
     {
         directInvocationPlans.put( LifecycleUtils.createMojoBindingKey( directInvocationBinding, true ), plan );
     }
-    
+
     public boolean hasDirectInvocationPlans()
     {
         return !directInvocationPlans.isEmpty();
     }
 
-    public List getPlanMojoBindings()
-        throws LifecycleSpecificationException, LifecyclePlannerException
+    public List getPlanMojoBindings( MavenProject project, LifecycleBindingManager bindingManager )
+        throws LifecycleSpecificationException, LifecyclePlannerException, LifecycleLoaderException
     {
         // null parameter here avoids creating an extra instance just for purposes of cloning.
         LifecycleBindings bindings = BuildPlanUtils.modifyPlanBindings( null, planModifiers );
-        
-        List result = BuildPlanUtils.assembleMojoBindingList( tasks, bindings, directInvocationPlans );
-        
+
+        List result = bindingManager.assembleMojoBindingList( tasks, bindings, directInvocationPlans, project );
+
         result.add( directInvocationBinding );
-        
+
         return result;
     }
 

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/ForkPlanModifier.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/ForkPlanModifier.java?view=diff&rev=518461&r1=518460&r2=518461
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/ForkPlanModifier.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/ForkPlanModifier.java Wed Mar 14 20:52:55 2007
@@ -1,15 +1,12 @@
 package org.apache.maven.lifecycle.plan;
 
-import org.apache.maven.lifecycle.LifecycleSpecificationException;
 import org.apache.maven.lifecycle.LifecycleUtils;
-import org.apache.maven.lifecycle.MojoBindingUtils;
 import org.apache.maven.lifecycle.model.LifecycleBindings;
 import org.apache.maven.lifecycle.model.MojoBinding;
 import org.apache.maven.lifecycle.model.Phase;
 import org.apache.maven.lifecycle.statemgmt.StateManagementUtils;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.Iterator;
 import java.util.List;
 
@@ -20,9 +17,7 @@
     private final MojoBinding modificationPoint;
     private List planModifiers = new ArrayList();
 
-    private List mojoBindings;
-    private LifecycleBindings lifecycleBindings;
-    private String lifecyclePhase;
+    private final List mojoBindings;
 
     public ForkPlanModifier( MojoBinding modificationPoint, List mojoBindings )
     {
@@ -30,14 +25,6 @@
         this.mojoBindings = mojoBindings;
     }
 
-    public ForkPlanModifier( MojoBinding modificationPoint, LifecycleBindings modifiedBindings, String phase )
-        throws LifecycleSpecificationException
-    {
-        this.modificationPoint = modificationPoint;
-        this.lifecycleBindings = modifiedBindings;
-        this.lifecyclePhase = phase;
-    }
-
     public MojoBinding getModificationPoint()
     {
         return modificationPoint;
@@ -73,20 +60,9 @@
             }
         }
         
-        phaseBindings.add( stopIndex, StateManagementUtils.createEndForkedExecutionMojoBinding() );
-        
-        if ( mojoBindings == null )
-        {
-            try
-            {
-                mojoBindings = BuildPlanUtils.assembleMojoBindingList( Collections.singletonList( lifecyclePhase ), lifecycleBindings );
-            }
-            catch ( LifecycleSpecificationException e )
-            {
-                throw new LifecyclePlannerException( "Error building modifications list for forked execution of " + MojoBindingUtils.toString( getModificationPoint() ) );
-            }
-        }
+        phaseBindings.add( stopIndex, StateManagementUtils.createClearForkedExecutionMojoBinding() );
         
+        phaseBindings.add( insertionIndex, StateManagementUtils.createEndForkedExecutionMojoBinding() );
         phaseBindings.addAll( insertionIndex, mojoBindings );
         phaseBindings.add( insertionIndex, StateManagementUtils.createStartForkedExecutionMojoBinding() );
         

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/ForkedLifecycleBuildPlan.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/ForkedLifecycleBuildPlan.java?view=diff&rev=518461&r1=518460&r2=518461
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/ForkedLifecycleBuildPlan.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/ForkedLifecycleBuildPlan.java Wed Mar 14 20:52:55 2007
@@ -1,9 +1,12 @@
 package org.apache.maven.lifecycle.plan;
 
+import org.apache.maven.lifecycle.LifecycleLoaderException;
 import org.apache.maven.lifecycle.LifecycleSpecificationException;
+import org.apache.maven.lifecycle.binding.LifecycleBindingManager;
 import org.apache.maven.lifecycle.model.LifecycleBindings;
 import org.apache.maven.lifecycle.model.MojoBinding;
 import org.apache.maven.lifecycle.statemgmt.StateManagementUtils;
+import org.apache.maven.project.MavenProject;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -21,14 +24,15 @@
         this.forkPoint = forkPoint;
     }
 
-    public List getPlanMojoBindings()
-        throws LifecycleSpecificationException, LifecyclePlannerException
+    public List getPlanMojoBindings(MavenProject project, LifecycleBindingManager bindingManager)
+        throws LifecycleSpecificationException, LifecyclePlannerException, LifecycleLoaderException
     {
-        List bindings = new ArrayList( super.getPlanMojoBindings() );
+        List bindings = new ArrayList( super.getPlanMojoBindings(project, bindingManager) );
         
         bindings.add( 0, StateManagementUtils.createStartForkedExecutionMojoBinding() );
-        bindings.add( forkPoint );
         bindings.add( StateManagementUtils.createEndForkedExecutionMojoBinding() );
+        bindings.add( forkPoint );
+        bindings.add( StateManagementUtils.createClearForkedExecutionMojoBinding() );
         
         return bindings;
     }

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=518461&r1=518460&r2=518461
==============================================================================
--- 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 Wed Mar 14 20:52:55 2007
@@ -1,9 +1,12 @@
 package org.apache.maven.lifecycle.plan;
 
+import org.apache.maven.lifecycle.LifecycleLoaderException;
 import org.apache.maven.lifecycle.LifecycleSpecificationException;
 import org.apache.maven.lifecycle.LifecycleUtils;
+import org.apache.maven.lifecycle.binding.LifecycleBindingManager;
 import org.apache.maven.lifecycle.model.LifecycleBindings;
 import org.apache.maven.lifecycle.model.MojoBinding;
+import org.apache.maven.project.MavenProject;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -15,9 +18,11 @@
 {
 
     private final List tasks;
+
     private final LifecycleBindings lifecycleBindings;
-    
+
     private List planModifiers = new ArrayList();
+
     private Map directInvocationPlans = new HashMap();
 
     public LifecycleBuildPlan( List tasks, LifecycleBindings lifecycleBindings )
@@ -26,14 +31,14 @@
         this.lifecycleBindings = lifecycleBindings;
     }
 
-    public List getPlanMojoBindings()
-        throws LifecycleSpecificationException, LifecyclePlannerException
+    public List getPlanMojoBindings( MavenProject project, LifecycleBindingManager bindingManager )
+        throws LifecycleSpecificationException, LifecyclePlannerException, LifecycleLoaderException
     {
         LifecycleBindings cloned = BuildPlanUtils.modifyPlanBindings( lifecycleBindings, planModifiers );
-        
-        return BuildPlanUtils.assembleMojoBindingList( tasks, cloned, directInvocationPlans );
+
+        return bindingManager.assembleMojoBindingList( tasks, cloned, directInvocationPlans, project );
     }
-    
+
     public List getTasks()
     {
         return tasks;



Mime
View raw message