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/08 22:25:43 UTC

svn commit: r516181 - 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/parser/ ma...

Author: jdcasey
Date: Thu Mar  8 13:25:42 2007
New Revision: 516181

URL: http://svn.apache.org/viewvc?view=rev&rev=516181
Log:
Ready to test and integrate into LifecycleExecutor.

Added:
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/LegacyLifecycleMappingParser.java   (with props)
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DefaultLifecyclePlanModifier.java   (with props)
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecycleOverlayPlanModifier.java   (with props)
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecyclePlanModifier.java   (with props)
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/ModifiablePlanElement.java   (with props)
    maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/MojoBindingParser.java   (with props)
    maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/PrefixedMojoBinding.java
      - copied, changed from r515816, maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/parser/PrefixedMojoBinding.java
Removed:
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/parser/
Modified:
    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/DefaultLifecyclePlan.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DefaultLifecyclePlanner.java
    maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecyclePlan.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-lifecycle/src/main/java/org/apache/maven/lifecycle/LifecycleUtils.java
    maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/mdo/maven-lifecycle.mdo

Added: 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/LegacyLifecycleMappingParser.java?view=auto&rev=516181
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/LegacyLifecycleMappingParser.java (added)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/LegacyLifecycleMappingParser.java Thu Mar  8 13:25:42 2007
@@ -0,0 +1,164 @@
+package org.apache.maven.lifecycle;
+
+import org.apache.maven.lifecycle.BuildBinding;
+import org.apache.maven.lifecycle.CleanBinding;
+import org.apache.maven.lifecycle.Lifecycle;
+import org.apache.maven.lifecycle.LifecycleBindings;
+import org.apache.maven.lifecycle.LifecycleExecutionException;
+import org.apache.maven.lifecycle.MojoBinding;
+import org.apache.maven.lifecycle.Phase;
+import org.apache.maven.lifecycle.SiteBinding;
+import org.apache.maven.lifecycle.mapping.LifecycleMapping;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.MojoExecution;
+import org.apache.maven.plugin.descriptor.MojoDescriptor;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.plugin.lifecycle.Execution;
+import org.codehaus.plexus.util.StringUtils;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.StringTokenizer;
+
+public final class LegacyLifecycleMappingParser
+{
+
+    public static LifecycleBindings parseDefaultMappings( List lifecycles )
+        throws LifecycleSpecificationException
+    {
+        LifecycleBindings bindings = new LifecycleBindings();
+        
+        bindings.setPackaging( "unmatched" );
+        
+        for ( Iterator it = lifecycles.iterator(); it.hasNext(); )
+        {
+            Lifecycle lifecycle = (Lifecycle) it.next();
+            
+            if ( "clean".equals( lifecycle.getId() ) )
+            {
+                bindings.setCleanBinding( parseCleanBindings( lifecycle.getDefaultPhases() ) );
+            }
+            else if ( "site".equals( lifecycle.getId() ) )
+            {
+                bindings.setSiteBinding( parseSiteBindings( lifecycle.getDefaultPhases() ) );
+            }
+            else if ( "default".equals( lifecycle.getId() ) )
+            {
+                bindings.setBuildBinding( parseBuildBindings( lifecycle.getDefaultPhases() ) );
+            }
+            else
+            {
+                throw new LifecycleSpecificationException( "Unrecognized lifecycle: " + lifecycle.getId() );
+            }
+        }
+        
+        LifecycleUtils.setOrigin( bindings, "Maven core" );
+
+        return bindings;
+    }
+
+    public static LifecycleBindings parseMappings( LifecycleMapping mapping, String packaging )
+        throws LifecycleSpecificationException
+    {
+        LifecycleBindings bindings = new LifecycleBindings();
+        bindings.setPackaging( packaging );
+
+        bindings.setCleanBinding( parseCleanBindings( mapping.getPhases( "clean" ) ) );
+        bindings.setBuildBinding( parseBuildBindings( mapping.getPhases( "default" ) ) );
+        bindings.setSiteBinding( parseSiteBindings( mapping.getPhases( "site" ) ) );
+        
+        LifecycleUtils.setOrigin( bindings, "Maven core" );
+
+        return bindings;
+    }
+    
+    private static BuildBinding parseBuildBindings( Map phases )
+        throws LifecycleSpecificationException
+    {
+        BuildBinding binding = new BuildBinding();
+
+        binding.setValidate( parsePhaseBindings( (String) phases.get( "validate" ) ) );
+        binding.setInitialize( parsePhaseBindings( (String) phases.get( "initialize" ) ) );
+        binding.setGenerateSources( parsePhaseBindings( (String) phases.get( "generate-sources" ) ) );
+        binding.setProcessSources( parsePhaseBindings( (String) phases.get( "process-sources" ) ) );
+        binding.setGenerateResources( parsePhaseBindings( (String) phases.get( "generate-resources" ) ) );
+        binding.setProcessResources( parsePhaseBindings( (String) phases.get( "process-resources" ) ) );
+        binding.setCompile( parsePhaseBindings( (String) phases.get( "compile" ) ) );
+        binding.setProcessClasses( parsePhaseBindings( (String) phases.get( "process-classes" ) ) );
+        binding.setGenerateTestSources( parsePhaseBindings( (String) phases.get( "generate-test-sources" ) ) );
+        binding.setProcessTestSources( parsePhaseBindings( (String) phases.get( "process-test-sources" ) ) );
+        binding.setGenerateTestResources( parsePhaseBindings( (String) phases.get( "generate-test-resources" ) ) );
+        binding.setProcessTestResources( parsePhaseBindings( (String) phases.get( "process-test-resources" ) ) );
+        binding.setTestCompile( parsePhaseBindings( (String) phases.get( "test-compile" ) ) );
+        binding.setProcessTestClasses( parsePhaseBindings( (String) phases.get( "process-test-classes" ) ) );
+        binding.setTest( parsePhaseBindings( (String) phases.get( "test" ) ) );
+        binding.setPreparePackage( parsePhaseBindings( (String) phases.get( "prepare-package" ) ) );
+        binding.setCreatePackage( parsePhaseBindings( (String) phases.get( "package" ) ) );
+        binding.setPreIntegrationTest( parsePhaseBindings( (String) phases.get( "pre-integration-test" ) ) );
+        binding.setIntegrationTest( parsePhaseBindings( (String) phases.get( "integration-test" ) ) );
+        binding.setPostIntegrationTest( parsePhaseBindings( (String) phases.get( "post-integration-test" ) ) );
+        binding.setVerify( parsePhaseBindings( (String) phases.get( "verify" ) ) );
+        binding.setInstall( parsePhaseBindings( (String) phases.get( "install" ) ) );
+        binding.setDeploy( parsePhaseBindings( (String) phases.get( "deploy" ) ) );
+
+        return binding;
+    }
+
+    private static CleanBinding parseCleanBindings( Map phaseMappings )
+        throws LifecycleSpecificationException
+    {
+        CleanBinding binding = new CleanBinding();
+
+        binding.setPreClean( parsePhaseBindings( (String) phaseMappings.get( "pre-clean" ) ) );
+        binding.setClean( parsePhaseBindings( (String) phaseMappings.get( "clean" ) ) );
+        binding.setPostClean( parsePhaseBindings( (String) phaseMappings.get( "post-clean" ) ) );
+
+        return binding;
+    }
+
+    private static Phase parsePhaseBindings( String bindingList )
+        throws LifecycleSpecificationException
+    {
+        Phase phase = new Phase();
+
+        if ( bindingList != null )
+        {
+            for ( StringTokenizer tok = new StringTokenizer( bindingList, "," ); tok.hasMoreTokens(); )
+            {
+                String rawBinding = tok.nextToken().trim();
+
+                MojoBinding binding = MojoBindingParser.parseMojoBinding( rawBinding, false );
+
+                if ( binding == null )
+                {
+                    continue;
+                }
+
+                phase.addBinding( binding );
+            }
+        }
+
+        return phase;
+    }
+
+    private static SiteBinding parseSiteBindings( Map phases )
+        throws LifecycleSpecificationException
+    {
+        SiteBinding binding = new SiteBinding();
+
+        binding.setPreSite( parsePhaseBindings( (String) phases.get( "pre-site" ) ) );
+        binding.setSite( parsePhaseBindings( (String) phases.get( "site" ) ) );
+        binding.setPostSite( parsePhaseBindings( (String) phases.get( "post-site" ) ) );
+
+        return binding;
+    }
+
+    private LegacyLifecycleMappingParser()
+    {
+    }
+
+}

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

Propchange: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/LegacyLifecycleMappingParser.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=516181&r1=516180&r2=516181
==============================================================================
--- 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 Thu Mar  8 13:25:42 2007
@@ -1,16 +1,19 @@
 package org.apache.maven.lifecycle.binding;
 
+import org.apache.maven.lifecycle.LegacyLifecycleMappingParser;
 import org.apache.maven.lifecycle.LifecycleBindingLoader;
 import org.apache.maven.lifecycle.LifecycleBindings;
 import org.apache.maven.lifecycle.LifecycleLoaderException;
 import org.apache.maven.lifecycle.LifecycleSpecificationException;
 import org.apache.maven.lifecycle.LifecycleUtils;
 import org.apache.maven.lifecycle.MojoBinding;
-import org.apache.maven.lifecycle.parser.LegacyLifecycleMappingParser;
+import org.apache.maven.lifecycle.MojoBindingParser;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.model.PluginExecution;
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
 import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.plugin.lifecycle.Execution;
+import org.apache.maven.plugin.lifecycle.Lifecycle;
 import org.apache.maven.plugin.loader.PluginLoader;
 import org.apache.maven.plugin.loader.PluginLoaderException;
 import org.apache.maven.project.MavenProject;
@@ -18,7 +21,11 @@
 import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
 import org.codehaus.plexus.logging.LogEnabled;
 import org.codehaus.plexus.logging.Logger;
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
+import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
@@ -35,7 +42,7 @@
 
     // configured. Moved out of DefaultLifecycleExecutor...
     private List legacyLifecycles;
-    
+
     public LifecycleBindings getBindingsForPackaging( MavenProject project )
         throws LifecycleLoaderException, LifecycleSpecificationException
     {
@@ -91,11 +98,11 @@
                     throw new LifecycleLoaderException( "Failed to load plugin: " + plugin.getKey() + ". Reason: "
                         + e.getMessage(), e );
                 }
-                
+
                 if ( loader != null )
                 {
                     bindings = loader.getBindings();
-                    
+
                     if ( bindings != null )
                     {
                         break;
@@ -122,10 +129,10 @@
         throws LifecycleLoaderException, LifecycleSpecificationException
     {
         String projectId = project.getId();
-        
+
         LifecycleBindings bindings = new LifecycleBindings();
         bindings.setPackaging( project.getPackaging() );
-        
+
         List plugins = project.getBuildPlugins();
         if ( plugins != null )
         {
@@ -133,27 +140,28 @@
             {
                 Plugin plugin = (Plugin) it.next();
                 PluginDescriptor pluginDescriptor = null;
-                
+
                 List executions = plugin.getExecutions();
                 if ( executions != null )
                 {
                     for ( Iterator execIt = executions.iterator(); execIt.hasNext(); )
                     {
                         PluginExecution execution = (PluginExecution) execIt.next();
-                        
+
                         List goals = execution.getGoals();
                         for ( Iterator goalIterator = goals.iterator(); goalIterator.hasNext(); )
                         {
                             String goal = (String) goalIterator.next();
-                            
+
                             MojoBinding mojoBinding = new MojoBinding();
-                            
+
                             mojoBinding.setGroupId( plugin.getGroupId() );
                             mojoBinding.setArtifactId( plugin.getArtifactId() );
                             mojoBinding.setVersion( plugin.getVersion() );
                             mojoBinding.setGoal( goal );
-                            mojoBinding.setDefaultConfiguration( execution.getConfiguration() );
-                            
+                            mojoBinding.setConfiguration( execution.getConfiguration() );
+                            mojoBinding.setExecutionId( execution.getId() );
+
                             String phase = execution.getPhase();
                             if ( phase == null )
                             {
@@ -165,28 +173,146 @@
                                     }
                                     catch ( PluginLoaderException e )
                                     {
-                                        throw new LifecycleLoaderException( "Failed to load plugin: " + plugin + ". Reason: " + e.getMessage(), e );
+                                        throw new LifecycleLoaderException( "Failed to load plugin: " + plugin + ". Reason: "
+                                            + e.getMessage(), e );
                                     }
                                 }
-                                
+
                                 MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( goal );
                                 phase = mojoDescriptor.getPhase();
-                                
+
                                 if ( phase == null )
                                 {
-                                    throw new LifecycleSpecificationException( "No phase specified for goal: " + goal + " in plugin: " + plugin.getKey() + " from POM: " + projectId );
+                                    throw new LifecycleSpecificationException( "No phase specified for goal: " + goal
+                                        + " in plugin: " + plugin.getKey() + " from POM: " + projectId );
                                 }
                             }
-                            
+
                             LifecycleUtils.addMojoBinding( phase, mojoBinding, bindings );
                         }
                     }
                 }
             }
         }
-        
+
         LifecycleUtils.setOrigin( bindings, projectId );
-        
+
+        return bindings;
+    }
+
+    public LifecycleBindings getPluginLifecycleOverlay( PluginDescriptor pluginDescriptor, String lifecycleId )
+        throws LifecycleLoaderException, LifecycleSpecificationException
+    {
+        Lifecycle lifecycleOverlay = null;
+
+        try
+        {
+            lifecycleOverlay = pluginDescriptor.getLifecycleMapping( lifecycleId );
+        }
+        catch ( IOException e )
+        {
+            throw new LifecycleLoaderException( "Unable to read lifecycle mapping file: " + e.getMessage(), e );
+        }
+        catch ( XmlPullParserException e )
+        {
+            throw new LifecycleLoaderException( "Unable to parse lifecycle mapping file: " + e.getMessage(), e );
+        }
+
+        if ( lifecycleOverlay == null )
+        {
+            throw new LifecycleLoaderException( "Lifecycle '" + lifecycleId + "' not found in plugin" );
+        }
+
+        LifecycleBindings bindings = new LifecycleBindings();
+
+        for ( Iterator i = lifecycleOverlay.getPhases().iterator(); i.hasNext(); )
+        {
+            org.apache.maven.plugin.lifecycle.Phase phase = (org.apache.maven.plugin.lifecycle.Phase) i.next();
+            List phaseBindings = new ArrayList();
+
+            for ( Iterator j = phase.getExecutions().iterator(); j.hasNext(); )
+            {
+                Execution exec = (Execution) j.next();
+
+                for ( Iterator k = exec.getGoals().iterator(); k.hasNext(); )
+                {
+                    String goal = (String) k.next();
+
+                    // Here we are looking to see if we have a mojo from an external plugin.
+                    // If we do then we need to lookup the plugin descriptor for the externally
+                    // referenced plugin so that we can overly the execution into the lifecycle.
+                    // An example of this is the corbertura plugin that needs to call the surefire
+                    // plugin in forking mode.
+                    //
+                    //<phase>
+                    //  <id>test</id>
+                    //  <executions>
+                    //    <execution>
+                    //      <goals>
+                    //        <goal>org.apache.maven.plugins:maven-surefire-plugin:test</goal>
+                    //      </goals>
+                    //      <configuration>
+                    //        <classesDirectory>${project.build.directory}/generated-classes/cobertura</classesDirectory>
+                    //        <ignoreFailures>true</ignoreFailures>
+                    //        <forkMode>once</forkMode>
+                    //      </configuration>
+                    //    </execution>
+                    //  </executions>
+                    //</phase>
+
+                    // ----------------------------------------------------------------------
+                    //
+                    // ----------------------------------------------------------------------
+
+                    MojoBinding binding;
+                    if ( goal.indexOf( ":" ) > 0 )
+                    {
+                        binding = MojoBindingParser.parseMojoBinding( goal, false );
+                    }
+                    else
+                    {
+                        binding = new MojoBinding();
+                        binding.setGroupId( pluginDescriptor.getGroupId() );
+                        binding.setArtifactId( pluginDescriptor.getArtifactId() );
+                        binding.setVersion( pluginDescriptor.getVersion() );
+                        binding.setGoal( goal );
+                    }
+
+                    Xpp3Dom configuration = (Xpp3Dom) exec.getConfiguration();
+                    if ( phase.getConfiguration() != null )
+                    {
+                        configuration = Xpp3Dom.mergeXpp3Dom( new Xpp3Dom( (Xpp3Dom) phase.getConfiguration() ), configuration );
+                    }
+
+                    binding.setConfiguration( configuration );
+                    binding.setOrigin( lifecycleId );
+
+                    LifecycleUtils.addMojoBinding( phase.getId(), binding, bindings );
+                    phaseBindings.add( binding );
+                }
+            }
+
+            if ( phase.getConfiguration() != null )
+            {
+                // Merge in general configuration for a phase.
+                // TODO: this is all kind of backwards from the POMM. Let's align it all under 2.1.
+                //   We should create a new lifecycle executor for modelVersion >5.0.0
+
+                // [jdcasey; 08-March-2007] Not sure what the above to-do references...how _should_
+                // this work??
+                for ( Iterator j = phaseBindings.iterator(); j.hasNext(); )
+                {
+                    MojoBinding binding = (MojoBinding) j.next();
+
+                    Xpp3Dom configuration = Xpp3Dom.mergeXpp3Dom( new Xpp3Dom( (Xpp3Dom) phase.getConfiguration() ),
+                                                                  (Xpp3Dom) binding.getConfiguration() );
+
+                    binding.setConfiguration( configuration );
+                }
+            }
+
+        }
+
         return bindings;
     }
 

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=516181&r1=516180&r2=516181
==============================================================================
--- 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 Thu Mar  8 13:25:42 2007
@@ -3,12 +3,13 @@
 import org.apache.maven.lifecycle.LifecycleBindings;
 import org.apache.maven.lifecycle.LifecycleLoaderException;
 import org.apache.maven.lifecycle.LifecycleSpecificationException;
+import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.project.MavenProject;
 
 // FIXME: This needs a better name!
 public interface LifecycleBindingManager
 {
-    
+
     String ROLE = LifecycleBindingManager.class.getName();
 
     LifecycleBindings getDefaultBindings()
@@ -20,4 +21,6 @@
     LifecycleBindings getProjectCustomBindings( MavenProject project )
         throws LifecycleLoaderException, LifecycleSpecificationException;
 
+    LifecycleBindings getPluginLifecycleOverlay( PluginDescriptor pluginDescriptor, String lifecycleId )
+        throws LifecycleLoaderException, LifecycleSpecificationException;
 }

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DefaultLifecyclePlan.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DefaultLifecyclePlan.java?view=diff&rev=516181&r1=516180&r2=516181
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DefaultLifecyclePlan.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DefaultLifecyclePlan.java Thu Mar  8 13:25:42 2007
@@ -1,16 +1,61 @@
 package org.apache.maven.lifecycle.plan;
 
+import org.apache.maven.lifecycle.LifecycleBindings;
+import org.apache.maven.lifecycle.LifecycleSpecificationException;
+import org.apache.maven.lifecycle.LifecycleUtils;
+
+import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 
 public class DefaultLifecyclePlan
     implements LifecyclePlan
 {
 
-    private final List planBindings;
+    private final List tasks;
+    private final LifecycleBindings lifecycleBindings;
+    
+    private List planModifiers = new ArrayList();
+
+    public DefaultLifecyclePlan( List tasks, LifecycleBindings lifecycleBindings )
+    {
+        this.tasks = tasks;
+        this.lifecycleBindings = lifecycleBindings;
+    }
+
+    public List getPlanMojoBindings()
+        throws LifecycleSpecificationException, LifecyclePlannerException
+    {
+        LifecycleBindings cloned = LifecycleUtils.cloneBindings( lifecycleBindings );
+        
+        for ( Iterator it = planModifiers.iterator(); it.hasNext(); )
+        {
+            LifecyclePlanModifier modifier = (LifecyclePlanModifier) it.next();
+            
+            cloned = modifier.modifyBindings( cloned );
+        }
+        
+        return LifecycleUtils.assembleMojoBindingList( tasks, cloned );
+    }
+    
+    public LifecycleBindings getPlanLifecycleBindings()
+    {
+        return lifecycleBindings;
+    }
+    
+    public List getTasks()
+    {
+        return tasks;
+    }
+
+    public void addModifier( LifecyclePlanModifier planModifier )
+    {
+        planModifiers.add( planModifier );
+    }
 
-    public DefaultLifecyclePlan( List planBindings )
+    public List getModifiers()
     {
-        this.planBindings = planBindings;
+        return planModifiers;
     }
 
 }

Added: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DefaultLifecyclePlanModifier.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DefaultLifecyclePlanModifier.java?view=auto&rev=516181
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DefaultLifecyclePlanModifier.java (added)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DefaultLifecyclePlanModifier.java Thu Mar  8 13:25:42 2007
@@ -0,0 +1,92 @@
+package org.apache.maven.lifecycle.plan;
+
+import org.apache.maven.lifecycle.LifecycleBindings;
+import org.apache.maven.lifecycle.LifecycleSpecificationException;
+import org.apache.maven.lifecycle.LifecycleUtils;
+import org.apache.maven.lifecycle.MojoBinding;
+import org.apache.maven.lifecycle.Phase;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+public class DefaultLifecyclePlanModifier
+    implements LifecyclePlanModifier
+{
+
+    private final MojoBinding modificationPoint;
+    private List planModifiers = new ArrayList();
+
+    private final List mojoBindings;
+
+    public DefaultLifecyclePlanModifier( MojoBinding modificationPoint, List mojoBindings )
+    {
+        this.modificationPoint = modificationPoint;
+        this.mojoBindings = mojoBindings;
+    }
+
+    public DefaultLifecyclePlanModifier( MojoBinding modificationPoint, LifecycleBindings modifiedBindings, String phase )
+        throws LifecycleSpecificationException
+    {
+        this.modificationPoint = modificationPoint;
+        this.mojoBindings = LifecycleUtils.assembleMojoBindingList( Collections.singletonList( phase ), modifiedBindings );
+    }
+
+    public MojoBinding getModificationPoint()
+    {
+        return modificationPoint;
+    }
+
+    public LifecycleBindings modifyBindings( LifecycleBindings bindings )
+        throws LifecyclePlannerException
+    {
+        Phase phase = LifecycleUtils.findPhaseForMojoBinding( getModificationPoint(), bindings, true );
+
+        String modificationKey = LifecycleUtils.createMojoBindingKey( getModificationPoint(), true );
+
+        if ( phase == null )
+        {
+            throw new LifecyclePlannerException( "Failed to modify plan. No phase found containing mojoBinding: "
+                + modificationKey );
+        }
+
+        int insertionIndex = -1;
+        List phaseBindings = phase.getBindings();
+
+        for ( int i = 0; i < phaseBindings.size(); i++ )
+        {
+            MojoBinding candidate = (MojoBinding) phaseBindings.get( i );
+
+            String key = LifecycleUtils.createMojoBindingKey( candidate, true );
+            if ( key.equals( modificationKey ) )
+            {
+                insertionIndex = i + 1;
+                break;
+            }
+        }
+        
+        phaseBindings.addAll( insertionIndex, mojoBindings );
+        phase.setBindings( phaseBindings );
+        
+        for ( Iterator it = planModifiers.iterator(); it.hasNext(); )
+        {
+            LifecyclePlanModifier modifier = (LifecyclePlanModifier) it.next();
+            
+            modifier.modifyBindings( bindings );
+        }
+
+        return bindings;
+    }
+
+    public void addModifier( LifecyclePlanModifier planModifier )
+    {
+        planModifiers.add( planModifier );
+    }
+
+    public List getModifiers()
+    {
+        return planModifiers;
+    }
+
+}

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

Propchange: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DefaultLifecyclePlanModifier.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/DefaultLifecyclePlanner.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DefaultLifecyclePlanner.java?view=diff&rev=516181&r1=516180&r2=516181
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DefaultLifecyclePlanner.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/DefaultLifecyclePlanner.java Thu Mar  8 13:25:42 2007
@@ -7,7 +7,6 @@
 import org.apache.maven.lifecycle.LifecycleUtils;
 import org.apache.maven.lifecycle.MojoBinding;
 import org.apache.maven.lifecycle.binding.LifecycleBindingManager;
-import org.apache.maven.lifecycle.parser.MojoReferenceParser;
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
 import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.plugin.loader.PluginLoader;
@@ -16,8 +15,9 @@
 import org.codehaus.plexus.logging.LogEnabled;
 import org.codehaus.plexus.logging.Logger;
 
-import java.util.ArrayList;
+import java.util.Collections;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
 
 public class DefaultLifecyclePlanner
@@ -37,7 +37,7 @@
         LifecycleBindings packagingBindings = lifecycleBindingManager.getBindingsForPackaging( project );
         LifecycleBindings projectBindings = lifecycleBindingManager.getProjectCustomBindings( project );
 
-        LifecycleBindings merged = LifecycleUtils.mergeBindings( packagingBindings, projectBindings, defaultBindings );
+        LifecycleBindings merged = LifecycleUtils.mergeBindings( packagingBindings, projectBindings, defaultBindings, 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
@@ -45,24 +45,26 @@
         // if the binding list is null, treat it like a one-off mojo invocation, and parse/validate
         //     that it can be called as such.
         // as binding lists accumulate, push them onto an aggregated "plan" listing...
-        List planBindings = assemblePlanBindings( tasks, merged, project );
-
-        LifecyclePlan plan = new DefaultLifecyclePlan( planBindings );
+        LifecyclePlan plan = new DefaultLifecyclePlan( tasks, merged );
 
         // Inject forked lifecycles as plan modifiers for each mojo that has @execute in it.
-        addForkedLifecycleModifiers( planBindings, plan, merged, project );
-        
+        addForkedLifecycleModifiers( plan, merged, project, tasks );
+
         // TODO: Inject relative-ordered project/plugin executions as plan modifiers.
 
         return plan;
     }
 
-    private void addForkedLifecycleModifiers( List planBindings, LifecyclePlan plan, LifecycleBindings mergedBindings, MavenProject project ) throws LifecyclePlannerException, LifecycleSpecificationException
+    private void addForkedLifecycleModifiers( ModifiablePlanElement planElement, LifecycleBindings lifecycleBindings,
+                                              MavenProject project, List tasks )
+        throws LifecyclePlannerException, LifecycleSpecificationException
     {
+        List planBindings = LifecycleUtils.assembleMojoBindingList( tasks, lifecycleBindings );
+        
         for ( Iterator it = planBindings.iterator(); it.hasNext(); )
         {
             MojoBinding mojoBinding = (MojoBinding) it.next();
-            
+
             PluginDescriptor pluginDescriptor;
             try
             {
@@ -72,110 +74,153 @@
             {
                 throw new LifecyclePlannerException( e.getMessage(), e );
             }
-            
+
             MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( mojoBinding.getGoal() );
             if ( mojoDescriptor == null )
             {
-                throw new LifecyclePlannerException( "Mojo: " + mojoBinding.getGoal() + " does not exist in plugin: " + pluginDescriptor.getId() + "." );
+                throw new LifecyclePlannerException( "Mojo: " + mojoBinding.getGoal() + " does not exist in plugin: "
+                    + pluginDescriptor.getId() + "." );
             }
-            
-            List forkedBindings = new ArrayList();
-            
-            findForkedBindings( forkedBindings, mojoBinding, pluginDescriptor, mergedBindings, project, new ArrayList() );
+
+            findForkModifiers( mojoBinding, pluginDescriptor, planElement, lifecycleBindings, project, new LinkedList(), tasks );
         }
     }
 
-    private void findForkedBindings( List forkedBindings, MojoBinding mojoBinding, PluginDescriptor pluginDescriptor, LifecycleBindings mergedBindings, MavenProject project, List forkingBindings ) throws LifecyclePlannerException, LifecycleSpecificationException
+    private void findForkModifiers( MojoBinding mojoBinding, PluginDescriptor pluginDescriptor,
+                                     ModifiablePlanElement planElement, LifecycleBindings mergedBindings, MavenProject project, 
+                                     LinkedList forkingBindings, List tasks )
+        throws LifecyclePlannerException, LifecycleSpecificationException
     {
-        String referencingGoal = mojoBinding.getGoal();
-        
-        MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( referencingGoal );
-        
-        if ( mojoDescriptor.getExecuteGoal() != null )
+        forkingBindings.addLast( mojoBinding );
+
+        try
         {
-            forkingBindings.add( mojoBinding );
-            String executeGoal = mojoDescriptor.getExecuteGoal();
-            
-            MojoDescriptor otherDescriptor = pluginDescriptor.getMojo( executeGoal );
-            if ( otherDescriptor == null )
+            String referencingGoal = mojoBinding.getGoal();
+
+            MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( referencingGoal );
+
+            if ( mojoDescriptor.getExecuteGoal() != null )
             {
-                throw new LifecyclePlannerException( "Mojo: " + executeGoal + " (referenced by: " + referencingGoal + ") does not exist in plugin: " + pluginDescriptor.getId() + "." );
+                recurseSingleMojoFork( mojoBinding, pluginDescriptor, planElement, mergedBindings, forkingBindings, tasks );
             }
-            
-            MojoBinding binding = new MojoBinding();
-            binding.setGroupId( pluginDescriptor.getGroupId() );
-            binding.setArtifactId( pluginDescriptor.getArtifactId() );
-            binding.setVersion( pluginDescriptor.getVersion() );
-            binding.setGoal( executeGoal );
-            binding.setOrigin( "Forked from " + referencingGoal );
-            
-            forkedBindings.add( binding );
-            
-            findForkedBindings( forkedBindings, binding, pluginDescriptor, mergedBindings, project, forkingBindings );
-        }
-        else if ( mojoDescriptor.getExecutePhase() != null )
-        {
-            forkingBindings.add( mojoBinding );
-            String phase = mojoDescriptor.getExecutePhase();
-            
-            LifecycleBinding binding = LifecycleUtils.findLifecycleBindingsForPhase( phase, mergedBindings );
-            if ( binding == null )
+            else if ( mojoDescriptor.getExecutePhase() != null )
             {
-                throw new LifecyclePlannerException( "Cannot find lifecycle for phase: " + phase );
+                recursePhaseMojoFork( mojoBinding, pluginDescriptor, planElement, mergedBindings, project, forkingBindings, tasks );
             }
-            
-            List mojoBindings = LifecycleUtils.getMojoBindings( phase, binding );
-            
-            LifecycleUtils.removeBindings( forkingBindings, mojoBindings );
+            else if ( mojoDescriptor.getExecuteLifecycle() != null )
+            {
+                recurseLifecycleOverlayFork( mojoBinding, pluginDescriptor, planElement, mergedBindings, project, forkingBindings, tasks );
+            }
+        }
+        finally
+        {
+            forkingBindings.removeLast();
+        }
+    }
+
+    private void recurseLifecycleOverlayFork( MojoBinding mojoBinding, PluginDescriptor pluginDescriptor,
+                                              ModifiablePlanElement planElement, LifecycleBindings mergedBindings, MavenProject project,
+                                              LinkedList forkingBindings, List tasks )
+        throws LifecycleSpecificationException, LifecyclePlannerException
+    {
+        String referencingGoal = mojoBinding.getGoal();
+
+        MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( referencingGoal );
 
-            forkedBindings.addAll( mojoBindings );
+        String executeLifecycle = mojoDescriptor.getExecuteLifecycle();
+
+        LifecycleBindings overlayBindings;
+        try
+        {
+            overlayBindings = lifecycleBindingManager.getPluginLifecycleOverlay( pluginDescriptor, executeLifecycle );
         }
-        else if ( mojoDescriptor.getExecuteLifecycle() != null )
+        catch ( LifecycleLoaderException e )
         {
-            // TODO: Handle lifecycle overlays!
+            throw new LifecyclePlannerException( "Failed to load overlay lifecycle: " + executeLifecycle + ". Reason: "
+                + e.getMessage(), e );
         }
+
+        // constructed to allow us to recurse for forks/modifications, etc.
+        LifecyclePlanModifier modifier = new LifecycleOverlayPlanModifier( overlayBindings );
+        
+        addForkedLifecycleModifiers( modifier, overlayBindings, project, tasks );
+        
+        planElement.addModifier( modifier );
     }
 
-    private List assemblePlanBindings( List tasks, LifecycleBindings mergedBindings, MavenProject project )
-        throws LifecycleSpecificationException
+    private void recursePhaseMojoFork( MojoBinding mojoBinding, PluginDescriptor pluginDescriptor,
+                                       ModifiablePlanElement planElement, LifecycleBindings mergedBindings, MavenProject project,
+                                       LinkedList forkingBindings, List tasks )
+        throws LifecyclePlannerException, LifecycleSpecificationException
     {
-        List planBindings = new ArrayList();
+        String referencingGoal = mojoBinding.getGoal();
 
-        List lastMojoBindings = null;
-        for ( Iterator it = tasks.iterator(); it.hasNext(); )
+        MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( referencingGoal );
+
+        String phase = mojoDescriptor.getExecutePhase();
+
+        LifecycleBinding binding = LifecycleUtils.findLifecycleBindingForPhase( phase, mergedBindings );
+        if ( binding == null )
         {
-            String task = (String) it.next();
+            throw new LifecyclePlannerException( "Cannot find lifecycle for phase: " + phase );
+        }
 
-            LifecycleBinding binding = LifecycleUtils.findLifecycleBindingsForPhase( task, mergedBindings );
-            if ( binding != null )
-            {
-                List mojoBindings = LifecycleUtils.getMojoBindings( task, binding );
+        LifecycleBindings cloned = LifecycleUtils.cloneBindings( mergedBindings );
 
-                // save these so we can reference the originals...
-                List originalMojoBindings = mojoBindings;
+        LifecycleUtils.removeMojoBindings( forkingBindings, cloned, false );
 
-                // if these mojo bindings are a superset of the last bindings, only add the difference.
-                if ( lastMojoBindings != null && mojoBindings.containsAll( mojoBindings ) )
-                {
-                    List revised = new ArrayList( mojoBindings );
-                    revised.removeAll( lastMojoBindings );
+        List forkedPhaseBindingList = LifecycleUtils.assembleMojoBindingList( Collections.singletonList( phase ), cloned );
+        
+        LifecyclePlanModifier modifier = new DefaultLifecyclePlanModifier( mojoBinding, forkedPhaseBindingList );
+        
+        for ( Iterator it = forkedPhaseBindingList.iterator(); it.hasNext(); )
+        {
+            MojoBinding forkedBinding = (MojoBinding) it.next();
+            
+            findForkModifiers( forkedBinding, pluginDescriptor, modifier, cloned, project, forkingBindings, tasks );
+        }
+        
+        planElement.addModifier( modifier );
+    }
 
-                    mojoBindings = revised;
-                }
+    private void recurseSingleMojoFork( MojoBinding mojoBinding, PluginDescriptor pluginDescriptor,
+                                        ModifiablePlanElement planElement, LifecycleBindings mergedBindings, LinkedList forkingBindings, List tasks )
+        throws LifecyclePlannerException, LifecycleSpecificationException
+    {
+        String referencingGoal = mojoBinding.getGoal();
 
-                planBindings.addAll( mojoBindings );
-                lastMojoBindings = originalMojoBindings;
+        MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( referencingGoal );
+
+        String executeGoal = mojoDescriptor.getExecuteGoal();
+
+        MojoDescriptor otherDescriptor = pluginDescriptor.getMojo( executeGoal );
+        if ( otherDescriptor == null )
+        {
+            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 );
+        binding.setOrigin( "Forked from " + referencingGoal );
+        
+        if ( !LifecycleUtils.isMojoBindingPresent( binding, forkingBindings, false ) )
+        {
+            planElement.addModifier( new DefaultLifecyclePlanModifier( mojoBinding, Collections.singletonList( binding ) ) );
+
+            forkingBindings.addLast( binding );
+            try
+            {
+                recurseSingleMojoFork( binding, pluginDescriptor, planElement, mergedBindings, forkingBindings, tasks );
             }
-            else
+            finally
             {
-                MojoBinding mojoBinding = MojoReferenceParser.parseMojoBinding( task, true );
-                mojoBinding.setOrigin( "direct invocation" );
-                
-                planBindings.add( mojoBinding );
+                forkingBindings.removeLast();
             }
         }
-        
-        return planBindings;
     }
 
     public void enableLogging( Logger logger )

Added: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecycleOverlayPlanModifier.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecycleOverlayPlanModifier.java?view=auto&rev=516181
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecycleOverlayPlanModifier.java (added)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecycleOverlayPlanModifier.java Thu Mar  8 13:25:42 2007
@@ -0,0 +1,53 @@
+package org.apache.maven.lifecycle.plan;
+
+import org.apache.maven.lifecycle.LifecycleBindings;
+import org.apache.maven.lifecycle.LifecycleUtils;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+public class LifecycleOverlayPlanModifier
+    implements LifecyclePlanModifier
+{
+    
+    private final LifecycleBindings overlay;
+    private List planModifiers = new ArrayList();
+
+    public LifecycleOverlayPlanModifier( LifecycleBindings overlay )
+    {
+        this.overlay = overlay;
+    }
+
+    public LifecycleBindings modifyBindings( LifecycleBindings bindings )
+        throws LifecyclePlannerException
+    {
+        LifecycleBindings cloned = LifecycleUtils.cloneBindings( overlay );
+        
+        if ( planModifiers != null && !planModifiers.isEmpty() )
+        {
+            for ( Iterator it = planModifiers.iterator(); it.hasNext(); )
+            {
+                LifecyclePlanModifier modifier = (LifecyclePlanModifier) it.next();
+                
+                cloned = modifier.modifyBindings( cloned );
+            }
+        }
+        
+        // the ordering of these LifecycleBindings instances may seem reversed, but it is done this
+        // way on purpose, in order to make the configurations from the main bindings be dominant
+        // over those specified in the lifecycle overlay.
+        return LifecycleUtils.mergeBindings( cloned, bindings, null, true );
+    }
+
+    public void addModifier( LifecyclePlanModifier planModifier )
+    {
+        planModifiers.add( planModifier );
+    }
+
+    public List getModifiers()
+    {
+        return planModifiers;
+    }
+
+}

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

Propchange: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecycleOverlayPlanModifier.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/LifecyclePlan.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecyclePlan.java?view=diff&rev=516181&r1=516180&r2=516181
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecyclePlan.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecyclePlan.java Thu Mar  8 13:25:42 2007
@@ -1,6 +1,18 @@
 package org.apache.maven.lifecycle.plan;
 
-public interface LifecyclePlan
+import org.apache.maven.lifecycle.LifecycleBindings;
+import org.apache.maven.lifecycle.LifecycleSpecificationException;
+
+import java.util.List;
+
+public interface LifecyclePlan extends ModifiablePlanElement
 {
+
+    List getPlanMojoBindings()
+        throws LifecycleSpecificationException, LifecyclePlannerException;
+    
+    LifecycleBindings getPlanLifecycleBindings();
+    
+    List getTasks();
 
 }

Added: maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecyclePlanModifier.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecyclePlanModifier.java?view=auto&rev=516181
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecyclePlanModifier.java (added)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/LifecyclePlanModifier.java Thu Mar  8 13:25:42 2007
@@ -0,0 +1,11 @@
+package org.apache.maven.lifecycle.plan;
+
+import org.apache.maven.lifecycle.LifecycleBindings;
+
+public interface LifecyclePlanModifier extends ModifiablePlanElement
+{
+
+    LifecycleBindings modifyBindings( LifecycleBindings bindings )
+        throws LifecyclePlannerException;
+
+}

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

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

Added: 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=auto&rev=516181
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/ModifiablePlanElement.java (added)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/plan/ModifiablePlanElement.java Thu Mar  8 13:25:42 2007
@@ -0,0 +1,12 @@
+package org.apache.maven.lifecycle.plan;
+
+import java.util.List;
+
+public interface ModifiablePlanElement
+{
+
+    void addModifier( LifecyclePlanModifier planModifier );
+
+    List getModifiers();
+    
+}

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

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

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=516181&r1=516180&r2=516181
==============================================================================
--- 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 Thu Mar  8 13:25:42 2007
@@ -6,7 +6,7 @@
 import org.apache.maven.context.BuildContextManager;
 import org.apache.maven.execution.SessionContext;
 import org.apache.maven.lifecycle.MojoBinding;
-import org.apache.maven.lifecycle.parser.PrefixedMojoBinding;
+import org.apache.maven.lifecycle.PrefixedMojoBinding;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.plugin.InvalidPluginException;
 import org.apache.maven.plugin.PluginManager;

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/LifecycleUtils.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/LifecycleUtils.java?view=diff&rev=516181&r1=516180&r2=516181
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/LifecycleUtils.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/LifecycleUtils.java Thu Mar  8 13:25:42 2007
@@ -1,8 +1,13 @@
 package org.apache.maven.lifecycle;
 
+import org.codehaus.plexus.util.xml.Xpp3Dom;
+
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedList;
 import java.util.List;
+import java.util.Map;
 
 public class LifecycleUtils
 {
@@ -63,7 +68,7 @@
     /**
      * @return null if the phase is not contained in any of the lifecycles.
      */
-    public static LifecycleBinding findLifecycleBindingsForPhase( String phaseName, LifecycleBindings lifecycles )
+    public static LifecycleBinding findLifecycleBindingForPhase( String phaseName, LifecycleBindings lifecycles )
     {
         List lifecyclesAvailable = lifecycles.getBindingList();
 
@@ -76,38 +81,85 @@
                 return lifecycle;
             }
         }
-        
+
         return null;
     }
 
-    public static void addMojoBinding( String phaseName, MojoBinding mojo, LifecycleBindings bindings )
-        throws LifecycleSpecificationException
+    public static void removeMojoBinding( String phaseName, MojoBinding mojoBinding, LifecycleBinding lifecycleBinding,
+                                          boolean considerExecutionId )
+        throws NoSuchPhaseException
     {
-        LifecycleBinding binding = findLifecycleBindingsForPhase( phaseName, bindings );
+        List phaseNames = lifecycleBinding.getPhaseNamesInOrder();
+
+        int idx = phaseNames.indexOf( phaseName );
+
+        if ( idx < 0 )
+        {
+            throw new NoSuchPhaseException( phaseName, "Phase: " + phaseName + " not found in lifecycle: "
+                + lifecycleBinding.getId() );
+        }
+
+        List phases = lifecycleBinding.getPhasesInOrder();
 
-        List phaseNames = binding.getPhaseNamesInOrder();
+        Phase phase = (Phase) phases.get( idx );
+        List mojoBindings = phase.getBindings();
+
+        String targetKey = createMojoBindingKey( mojoBinding, considerExecutionId );
+
+        for ( Iterator it = mojoBindings.iterator(); it.hasNext(); )
+        {
+            MojoBinding candidate = (MojoBinding) it.next();
+
+            String candidateKey = createMojoBindingKey( candidate, considerExecutionId );
+            if ( candidateKey.equals( targetKey ) )
+            {
+                it.remove();
+            }
+        }
+
+        phase.setBindings( mojoBindings );
+    }
+
+    public static void addMojoBinding( String phaseName, MojoBinding mojoBinding, LifecycleBinding lifecycleBinding )
+        throws NoSuchPhaseException
+    {
+        List phaseNames = lifecycleBinding.getPhaseNamesInOrder();
 
         int idx = phaseNames.indexOf( phaseName );
 
         if ( idx < 0 )
         {
-            throw new NoSuchPhaseException( phaseName, "Phase not found in lifecycle: " + binding.getId() );
+            throw new NoSuchPhaseException( phaseName, "Phase: " + phaseName + " not found in lifecycle: "
+                + lifecycleBinding.getId() );
         }
 
-        List phases = binding.getPhasesInOrder();
+        List phases = lifecycleBinding.getPhasesInOrder();
 
         Phase phase = (Phase) phases.get( idx );
-        phase.addBinding( mojo );
+        phase.addBinding( mojoBinding );
     }
 
-    public static LifecycleBindings mergeBindings( LifecycleBindings packagingBindings, LifecycleBindings projectBindings,
-                                                   LifecycleBindings defaultBindings )
+    public static void addMojoBinding( String phaseName, MojoBinding mojo, LifecycleBindings bindings )
+        throws LifecycleSpecificationException
+    {
+        LifecycleBinding binding = findLifecycleBindingForPhase( phaseName, bindings );
+
+        if ( binding == null )
+        {
+            throw new NoSuchPhaseException( phaseName, "Phase not found in any lifecycle: " + phaseName );
+        }
+
+        addMojoBinding( phaseName, mojo, binding );
+    }
+
+    public static LifecycleBindings mergeBindings( LifecycleBindings existingBindings, LifecycleBindings newBindings,
+                                                   LifecycleBindings defaultBindings, boolean mergeConfigIfExecutionIdMatches )
     {
         LifecycleBindings result = new LifecycleBindings();
-        result.setPackaging( projectBindings.getPackaging() );
+        result.setPackaging( newBindings.getPackaging() );
 
-        CleanBinding cb = packagingBindings.getCleanBinding();
-        if ( cb == null )
+        CleanBinding cb = existingBindings.getCleanBinding();
+        if ( defaultBindings != null && cb == null )
         {
             cb = defaultBindings.getCleanBinding();
         }
@@ -119,8 +171,8 @@
 
         result.setCleanBinding( cb );
 
-        BuildBinding bb = packagingBindings.getBuildBinding();
-        if ( bb == null )
+        BuildBinding bb = existingBindings.getBuildBinding();
+        if ( defaultBindings != null && bb == null )
         {
             bb = defaultBindings.getBuildBinding();
         }
@@ -132,8 +184,8 @@
 
         result.setBuildBinding( bb );
 
-        SiteBinding sb = packagingBindings.getSiteBinding();
-        if ( sb == null )
+        SiteBinding sb = existingBindings.getSiteBinding();
+        if ( defaultBindings != null && sb == null )
         {
             sb = defaultBindings.getSiteBinding();
         }
@@ -145,7 +197,7 @@
 
         result.setSiteBinding( sb );
 
-        for ( Iterator bindingIt = projectBindings.getBindingList().iterator(); bindingIt.hasNext(); )
+        for ( Iterator bindingIt = newBindings.getBindingList().iterator(); bindingIt.hasNext(); )
         {
             LifecycleBinding lifecycleBinding = (LifecycleBinding) bindingIt.next();
 
@@ -165,6 +217,23 @@
                         {
                             MojoBinding mojoBinding = (MojoBinding) phaseIt.next();
 
+                            if ( mergeConfigIfExecutionIdMatches )
+                            {
+                                MojoBinding matchingBinding = findMatchingMojoBinding( mojoBinding, existingBindings, true );
+
+                                if ( matchingBinding != null )
+                                {
+                                    mojoBinding = cloneMojoBinding( (MojoBinding) phaseIt.next() );
+
+                                    Xpp3Dom existingConfig = new Xpp3Dom( (Xpp3Dom) matchingBinding.getConfiguration() );
+
+                                    Xpp3Dom configuration = Xpp3Dom.mergeXpp3Dom( existingConfig,
+                                                                                  (Xpp3Dom) mojoBinding.getConfiguration() );
+
+                                    mojoBinding.setConfiguration( configuration );
+                                }
+                            }
+
                             try
                             {
                                 addMojoBinding( name, mojoBinding, result );
@@ -176,7 +245,7 @@
                                 IllegalArgumentException error = new IllegalArgumentException(
                                                                                                "Project bindings are invalid. Reason: "
                                                                                                    + e.getMessage() );
-                                
+
                                 error.initCause( e );
 
                                 throw error;
@@ -190,32 +259,277 @@
         return result;
     }
 
-    public static void removeBindings( List toRemove, List removeFrom )
+    public static MojoBinding findMatchingMojoBinding( MojoBinding mojoBinding, LifecycleBindings inBindings,
+                                                       boolean considerExecutionId )
+    {
+        String key = createMojoBindingKey( mojoBinding, considerExecutionId );
+
+        return (MojoBinding) mapMojoBindingsByKey( inBindings, considerExecutionId ).get( key );
+    }
+
+    private static Map mapMojoBindingsByKey( LifecycleBindings bindings, boolean considerExecutionId )
+    {
+        Map byKey = new HashMap();
+
+        for ( Iterator bindingIt = bindings.getBindingList().iterator(); bindingIt.hasNext(); )
+        {
+            LifecycleBinding binding = (LifecycleBinding) bindingIt.next();
+
+            for ( Iterator phaseIt = binding.getPhasesInOrder().iterator(); phaseIt.hasNext(); )
+            {
+                Phase phase = (Phase) phaseIt.next();
+
+                for ( Iterator mojoIt = phase.getBindings().iterator(); mojoIt.hasNext(); )
+                {
+                    MojoBinding mojoBinding = (MojoBinding) mojoIt.next();
+
+                    byKey.put( createMojoBindingKey( mojoBinding, considerExecutionId ), mojoBinding );
+                }
+            }
+        }
+
+        return byKey;
+    }
+
+    public static void removeMojoBindings( List toRemove, LifecycleBindings bindings, boolean considerExecutionId )
+        throws NoSuchPhaseException
+    {
+        if ( bindings.getCleanBinding() != null )
+        {
+            removeMojoBindings( toRemove, bindings.getCleanBinding(), considerExecutionId );
+        }
+
+        if ( bindings.getBuildBinding() != null )
+        {
+            removeMojoBindings( toRemove, bindings.getBuildBinding(), considerExecutionId );
+        }
+
+        if ( bindings.getSiteBinding() != null )
+        {
+            removeMojoBindings( toRemove, bindings.getSiteBinding(), considerExecutionId );
+        }
+    }
+
+    public static void removeMojoBindings( List toRemove, LifecycleBinding removeFrom, boolean considerExecutionId )
+        throws NoSuchPhaseException
     {
         // remove where gid:aid:goal matches.
         List targets = new ArrayList();
         for ( Iterator it = toRemove.iterator(); it.hasNext(); )
         {
             MojoBinding binding = (MojoBinding) it.next();
-            
-            targets.add( createMojoBindingKey( binding ) );
+
+            targets.add( createMojoBindingKey( binding, considerExecutionId ) );
         }
+
+        List phases = removeFrom.getPhasesInOrder();
+        List names = removeFrom.getPhaseNamesInOrder();
+
+        for ( int i = 0; i < phases.size(); i++ )
+        {
+            Phase phase = (Phase) phases.get( i );
+            String phaseName = (String) names.get( i );
+
+            for ( Iterator mojoIt = phase.getBindings().iterator(); mojoIt.hasNext(); )
+            {
+                MojoBinding binding = (MojoBinding) mojoIt.next();
+                String key = createMojoBindingKey( binding, considerExecutionId );
+                if ( targets.contains( key ) )
+                {
+                    removeMojoBinding( phaseName, binding, removeFrom, considerExecutionId );
+                }
+            }
+        }
+    }
+
+    public static String createMojoBindingKey( MojoBinding mojoBinding, boolean considerExecutionId )
+    {
+        String key = mojoBinding.getGroupId() + ":" + mojoBinding.getArtifactId() + ":" + mojoBinding.getGoal();
+
+        if ( considerExecutionId )
+        {
+            key += ":" + mojoBinding.getExecutionId();
+        }
+
+        return key;
+    }
+
+    public static LifecycleBindings cloneBindings( LifecycleBindings bindings )
+    {
+        LifecycleBindings result = new LifecycleBindings();
+
+        if ( bindings.getCleanBinding() != null )
+        {
+            result.setCleanBinding( (CleanBinding) cloneBinding( bindings.getCleanBinding() ) );
+        }
+
+        if ( bindings.getBuildBinding() != null )
+        {
+            result.setBuildBinding( (BuildBinding) cloneBinding( bindings.getBuildBinding() ) );
+        }
+
+        if ( bindings.getSiteBinding() != null )
+        {
+            result.setSiteBinding( (SiteBinding) cloneBinding( bindings.getSiteBinding() ) );
+        }
+
+        return result;
+    }
+
+    public static LifecycleBinding cloneBinding( LifecycleBinding binding )
+    {
+        LifecycleBinding result;
+        if ( binding instanceof CleanBinding )
+        {
+            result = new CleanBinding();
+        }
+        else if ( binding instanceof SiteBinding )
+        {
+            result = new SiteBinding();
+        }
+        else if ( binding instanceof BuildBinding )
+        {
+            result = new BuildBinding();
+        }
+        else
+        {
+            throw new IllegalArgumentException( "Unrecognized LifecycleBinding type: " + binding.getClass().getName()
+                + "; cannot clone." );
+        }
+
+        List phases = binding.getPhasesInOrder();
+        List names = binding.getPhaseNamesInOrder();
+
+        for ( int i = 0; i < phases.size(); i++ )
+        {
+            Phase phase = (Phase) phases.get( i );
+            String phaseName = (String) names.get( i );
+
+            for ( Iterator mojoIt = phase.getBindings().iterator(); mojoIt.hasNext(); )
+            {
+                MojoBinding originalBinding = (MojoBinding) mojoIt.next();
+
+                MojoBinding newBinding = cloneMojoBinding( originalBinding );
+
+                try
+                {
+                    addMojoBinding( phaseName, newBinding, result );
+                }
+                catch ( NoSuchPhaseException e )
+                {
+                    IllegalStateException error = new IllegalStateException( e.getMessage()
+                        + "\nSomething strange is going on. Cloning should not encounter such inconsistencies." );
+
+                    error.initCause( e );
+
+                    throw error;
+                }
+            }
+        }
+
+        return result;
+    }
+
+    public static MojoBinding cloneMojoBinding( MojoBinding binding )
+    {
+        MojoBinding result = new MojoBinding();
+
+        result.setGroupId( binding.getGroupId() );
+        result.setArtifactId( binding.getArtifactId() );
+        result.setVersion( binding.getVersion() );
+        result.setConfiguration( binding.getConfiguration() );
+        result.setExecutionId( binding.getExecutionId() );
+        result.setGoal( binding.getGoal() );
+        result.setOrigin( binding.getOrigin() );
+
+        return result;
+    }
+
+    public static List assembleMojoBindingList( List tasks, LifecycleBindings lifecycleBindings )
+        throws LifecycleSpecificationException
+    {
+        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.getMojoBindings( 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 ( lastMojoBindings != null && mojoBindings.containsAll( mojoBindings ) )
+                {
+                    List revised = new ArrayList( mojoBindings );
+                    revised.removeAll( lastMojoBindings );
+
+                    mojoBindings = revised;
+                }
+
+                planBindings.addAll( mojoBindings );
+                lastMojoBindings = originalMojoBindings;
+            }
+            else
+            {
+                MojoBinding mojoBinding = MojoBindingParser.parseMojoBinding( task, true );
+                mojoBinding.setOrigin( "direct invocation" );
+
+                planBindings.add( mojoBinding );
+            }
+        }
+
+        return planBindings;
+    }
+
+    public static Phase findPhaseForMojoBinding( MojoBinding mojoBinding, LifecycleBindings lifecycleBindings, boolean considerExecutionId )
+    {
+        String targetKey = createMojoBindingKey( mojoBinding, considerExecutionId );
         
-        for ( Iterator it = removeFrom.iterator(); it.hasNext(); )
+        for ( Iterator lifecycleIt = lifecycleBindings.getBindingList().iterator(); lifecycleIt.hasNext(); )
         {
-            MojoBinding binding = (MojoBinding) it.next();
+            LifecycleBinding binding = (LifecycleBinding) lifecycleIt.next();
             
-            String key = createMojoBindingKey( binding );
-            if ( targets.contains( key ) )
+            for ( Iterator phaseIt = binding.getPhasesInOrder().iterator(); phaseIt.hasNext(); )
             {
-                it.remove();
+                Phase phase = (Phase) phaseIt.next();
+    
+                for ( Iterator mojoIt = phase.getBindings().iterator(); mojoIt.hasNext(); )
+                {
+                    MojoBinding candidate = (MojoBinding) mojoIt.next();
+                    String key = createMojoBindingKey( candidate, considerExecutionId );
+                    if ( key.equals( targetKey ) )
+                    {
+                        return phase;
+                    }
+                }
             }
         }
+        
+        return null;
     }
-    
-    public static String createMojoBindingKey( MojoBinding mojoBinding )
+
+    public static boolean isMojoBindingPresent( MojoBinding binding, LinkedList candidates, boolean considerExecutionId )
     {
-        return mojoBinding.getGroupId() + ":" + mojoBinding.getArtifactId() + ":" + mojoBinding.getGoal();
-    }
+        String key = createMojoBindingKey( binding, considerExecutionId );
+        
+        for ( Iterator it = candidates.iterator(); it.hasNext(); )
+        {
+            MojoBinding candidate = (MojoBinding) it.next();
+            
+            String candidateKey = createMojoBindingKey( candidate, considerExecutionId );
+            
+            if ( candidateKey.equals( key ) )
+            {
+                return true;
+            }
+        }
 
+        return false;
+    }
 }

Added: maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/MojoBindingParser.java
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/MojoBindingParser.java?view=auto&rev=516181
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/MojoBindingParser.java (added)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/MojoBindingParser.java Thu Mar  8 13:25:42 2007
@@ -0,0 +1,63 @@
+package org.apache.maven.lifecycle;
+
+import org.apache.maven.lifecycle.MojoBinding;
+
+import java.util.StringTokenizer;
+
+public final class MojoBindingParser
+{
+
+    private MojoBindingParser()
+    {
+    }
+
+    public static MojoBinding parseMojoBinding( String bindingSpec, boolean allowPrefixReference )
+        throws LifecycleSpecificationException
+    {
+        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 );
+            }
+
+            binding = new PrefixedMojoBinding();
+
+            ( (PrefixedMojoBinding) binding ).setPrefix( tok.nextToken() );
+            binding.setGoal( tok.nextToken() );
+
+        }
+        else if ( numTokens == 3 || numTokens == 4 )
+        {
+            binding = new MojoBinding();
+
+            binding.setGroupId( tok.nextToken() );
+            binding.setArtifactId( tok.nextToken() );
+
+            if ( numTokens == 4 )
+            {
+                binding.setVersion( tok.nextToken() );
+            }
+
+            binding.setGoal( tok.nextToken() );
+        }
+        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;
+    }
+
+}

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

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

Copied: maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/PrefixedMojoBinding.java (from r515816, maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/parser/PrefixedMojoBinding.java)
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/PrefixedMojoBinding.java?view=diff&rev=516181&p1=maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/parser/PrefixedMojoBinding.java&r1=515816&p2=maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/PrefixedMojoBinding.java&r2=516181
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-core/src/main/java/org/apache/maven/lifecycle/parser/PrefixedMojoBinding.java (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/java/org/apache/maven/lifecycle/PrefixedMojoBinding.java Thu Mar  8 13:25:42 2007
@@ -1,4 +1,4 @@
-package org.apache.maven.lifecycle.parser;
+package org.apache.maven.lifecycle;
 
 import org.apache.maven.lifecycle.MojoBinding;
 

Modified: maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/mdo/maven-lifecycle.mdo
URL: http://svn.apache.org/viewvc/maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/mdo/maven-lifecycle.mdo?view=diff&rev=516181&r1=516180&r2=516181
==============================================================================
--- maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/mdo/maven-lifecycle.mdo (original)
+++ maven/components/branches/2.1-lifecycle-refactor/maven-lifecycle/src/main/mdo/maven-lifecycle.mdo Thu Mar  8 13:25:42 2007
@@ -542,15 +542,22 @@
           <type>String</type>
         </field>
         <field>
+          <name>executionId</name>
+          <version>1.0.0</version>
+          <defaultValue>default</defaultValue>
+          <description>A name for this mojo binding, for purposes of merging configurations via inheritance, etc.</description>
+          <type>String</type>
+        </field>
+        <field>
           <version>1.0.0</version>
           <name>origin</name>
           <type>String</type>
           <description>Specific location from which this set of mojo binding was loaded.</description>
         </field>
         <field>
-          <name>defaultConfiguration</name>
+          <name>configuration</name>
           <version>1.0.0</version>
-          <description>Mojo's default configuration (will NOT be merged with config given in the POM).</description>
+          <description>Mojo binding's configuration.</description>
           <type>DOM</type>
         </field>
       </fields>