Author: jvanzyl
Date: Sun Mar 22 07:39:57 2009
New Revision: 757141

URL: http://svn.apache.org/viewvc?rev=757141&view=rev
Log: (empty)

Added:
    
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleMapping.java
   (contents, props changed)
      - copied, changed from r756640, 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java
    
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleMapping.java
   (contents, props changed)
      - copied, changed from r756640, 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/LifecycleMapping.java
Removed:
    
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/
Modified:
    
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
    
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/Lifecycle.java
    
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
    
maven/components/branches/MNG-2766/maven-core/src/main/resources/META-INF/plexus/artifact-handlers.xml
    
maven/components/branches/MNG-2766/maven-core/src/main/resources/META-INF/plexus/components.xml
    
maven/components/branches/MNG-2766/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java
    
maven/components/branches/MNG-2766/maven-project/src/main/java/org/apache/maven/project/MavenProject.java

Modified: 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL: 
http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=757141&r1=757140&r2=757141&view=diff
==============================================================================
--- 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
 (original)
+++ 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
 Sun Mar 22 07:39:57 2009
@@ -30,7 +30,6 @@
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.execution.ReactorManager;
-import org.apache.maven.lifecycle.mapping.LifecycleMapping;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.model.PluginExecution;
 import org.apache.maven.model.ReportPlugin;
@@ -54,7 +53,6 @@
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.reporting.MavenReport;
 import org.codehaus.plexus.component.annotations.Requirement;
-import 
org.codehaus.plexus.component.repository.exception.ComponentLookupException;
 import org.codehaus.plexus.logging.AbstractLogEnabled;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.xml.Xpp3Dom;
@@ -80,6 +78,9 @@
 
     private Map phaseToLifecycleMap;
 
+    @Requirement
+    private Map<String,LifecycleMapping> lifecycleMappings;
+    
     public List<String> getLifecyclePhases()
     {
         for ( Lifecycle lifecycle : lifecycles )
@@ -976,8 +977,6 @@
     {
         Map mappings = findMappingsForLifecycle( session, project, lifecycle );
 
-        List optionalMojos = findOptionalMojosForLifecycle( session, project, 
lifecycle );
-
         Map lifecycleMappings = new HashMap();
 
         for ( Iterator i = lifecycle.getPhases().iterator(); i.hasNext(); )
@@ -1030,18 +1029,9 @@
 
         if ( mappings == null )
         {
-            try
-            {
-                m = (LifecycleMapping) session.lookup( LifecycleMapping.ROLE, 
packaging );
-                mappings = m.getPhases( lifecycle.getId() );
-            }
-            catch ( ComponentLookupException e )
-            {
-                if ( defaultMappings == null )
-                {
-                    throw new LifecycleExecutionException( "Cannot find 
lifecycle mapping for packaging: \'" + packaging + "\'.", e );
-                }
-            }
+            m = lifecycleMappings.get( packaging );
+                        
+            mappings = m.getPhases( lifecycle.getId() );                    
         }
 
         if ( mappings == null )
@@ -1059,35 +1049,6 @@
         return mappings;
     }
 
-    private List findOptionalMojosForLifecycle( MavenSession session, 
MavenProject project, Lifecycle lifecycle )
-        throws LifecycleExecutionException, PluginNotFoundException
-    {
-        String packaging = project.getPackaging();
-        List optionalMojos = null;
-
-        LifecycleMapping m;
-
-        if ( optionalMojos == null )
-        {
-            try
-            {
-                m = (LifecycleMapping) session.lookup( LifecycleMapping.ROLE, 
packaging );
-                optionalMojos = m.getOptionalMojos( lifecycle.getId() );
-            }
-            catch ( ComponentLookupException e )
-            {
-                getLogger().debug( "Error looking up lifecycle mapping to 
retrieve optional mojos. Lifecycle ID: " + lifecycle.getId() + ". Error: " + 
e.getMessage(), e );
-            }
-        }
-
-        if ( optionalMojos == null )
-        {
-            optionalMojos = Collections.EMPTY_LIST;
-        }
-
-        return optionalMojos;
-    }
-
     /**
      * Take each mojo contained with a plugin, look to see whether it 
contributes to a phase in the
      * lifecycle and if it does place it at the end of the list of goals to 
execute for that given

Copied: 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleMapping.java
 (from r756640, 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java)
URL: 
http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleMapping.java?p2=maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleMapping.java&p1=maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java&r1=756640&r2=757141&rev=757141&view=diff
==============================================================================
--- 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java
 (original)
+++ 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleMapping.java
 Sun Mar 22 07:39:57 2009
@@ -1,4 +1,4 @@
-package org.apache.maven.lifecycle.mapping;
+package org.apache.maven.lifecycle;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -24,23 +24,14 @@
 import java.util.List;
 import java.util.Map;
 
-/**
- * Lifecycle mapping for a POM.
- *
- * @author <a href="mailto:[email protected]";>Brett Porter</a>
- * @version $Id$
- */
 public class DefaultLifecycleMapping
     implements LifecycleMapping
 {
-    private List lifecycles;
+    private List<Lifecycle> lifecycles;
 
-    private Map lifecycleMap;
-
-    /** @deprecated use lifecycles instead */
-    private Map phases;
+    private Map<String,Lifecycle> lifecycleMap;
     
-    public List getOptionalMojos( String lifecycle )
+    public Map getPhases( String lifecycleId )
     {
         if ( lifecycleMap == null )
         {
@@ -48,56 +39,22 @@
 
             if ( lifecycles != null )
             {
-                for ( Iterator i = lifecycles.iterator(); i.hasNext(); )
+                for ( Lifecycle lifecycle : lifecycles )
                 {
-                    Lifecycle l = (Lifecycle) i.next();
-                    lifecycleMap.put( l.getId(), l );
+                    lifecycleMap.put( lifecycle.getId(), lifecycle );
                 }
             }
         }
-        Lifecycle l = (Lifecycle) lifecycleMap.get( lifecycle );
+        
+        Lifecycle lifecycle = (Lifecycle) lifecycleMap.get( lifecycleId );
 
-        if ( l != null )
+        Map<String,String> mappings = new HashMap<String,String>();
+        
+        for( String phase : lifecycle.getPhases() )
         {
-            return l.getOptionalMojos();
+            mappings.put( phase, phase );
         }
-        else
-        {
-            return null;
-        }
-    }
-
-    public Map getPhases( String lifecycle )
-    {
-        if ( lifecycleMap == null )
-        {
-            lifecycleMap = new HashMap();
-
-            if ( lifecycles != null )
-            {
-                for ( Iterator i = lifecycles.iterator(); i.hasNext(); )
-                {
-                    Lifecycle l = (Lifecycle) i.next();
-                    lifecycleMap.put( l.getId(), l );
-                }
-            }
-        }
-        Lifecycle l = (Lifecycle) lifecycleMap.get( lifecycle );
-
-        Map mappings = null;
-        if ( l == null )
-        {
-            if ( "default".equals( lifecycle ) )
-            {
-                mappings = phases;
-            }
-        }
-        else
-        {
-            mappings = l.getPhases();
-        }
-
+        
         return mappings;
     }
-
 }

Propchange: 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleMapping.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleMapping.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleMapping.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Sun Mar 22 07:39:57 2009
@@ -0,0 +1,7 @@
+/maven/components/branches/MNG-3932-1/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java:746145-746157
+/maven/components/branches/maven-2.0.10-RC/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java:680477
+/maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java:679206,708871,720042,726541,727548,727998,728264,728940,729060,729738,729785,730631
+/maven/components/branches/maven-2.1.x/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java:739385,741841,747468,748815,749612
+/maven/components/branches/sisbell-plugin-manager/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java:738973-739966
+/maven/components/sisbell-plugin-manager/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java:738757-738972
+/maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/DefaultLifecycleMapping.java:688587-696625,696644-699681

Modified: 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/Lifecycle.java
URL: 
http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/Lifecycle.java?rev=757141&r1=757140&r2=757141&view=diff
==============================================================================
--- 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/Lifecycle.java
 (original)
+++ 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/Lifecycle.java
 Sun Mar 22 07:39:57 2009
@@ -36,13 +36,13 @@
     /**
      * Field phases
      */
-    private List phases;
+    private List<String> phases;
 
     /**
      * default phases.
      */
     private Map defaultPhases;
-
+    
     /**
      * Method addPhase
      *
@@ -64,11 +64,11 @@
     /**
      * Method getPhases
      */
-    public List getPhases()
+    public List<String> getPhases()
     {
         if ( this.phases == null )
         {
-            this.phases = new ArrayList();
+            this.phases = new ArrayList<String>();
         }
 
         return this.phases;
@@ -97,5 +97,5 @@
     public Map getDefaultPhases()
     {
         return defaultPhases;
-    }
+    }    
 }

Copied: 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleMapping.java
 (from r756640, 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/LifecycleMapping.java)
URL: 
http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleMapping.java?p2=maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleMapping.java&p1=maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/LifecycleMapping.java&r1=756640&r2=757141&rev=757141&view=diff
==============================================================================
--- 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/LifecycleMapping.java
 (original)
+++ 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleMapping.java
 Sun Mar 22 07:39:57 2009
@@ -1,4 +1,4 @@
-package org.apache.maven.lifecycle.mapping;
+package org.apache.maven.lifecycle;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -19,7 +19,6 @@
  * under the License.
  */
 
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -29,8 +28,6 @@
 public interface LifecycleMapping
 {
     String ROLE = LifecycleMapping.class.getName();
-
-    List getOptionalMojos( String lifecycle );
-    
+        
     Map getPhases( String lifecycle );
 }

Propchange: 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleMapping.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleMapping.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleMapping.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Sun Mar 22 07:39:57 2009
@@ -0,0 +1,7 @@
+/maven/components/branches/MNG-3932-1/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/LifecycleMapping.java:746145-746157
+/maven/components/branches/maven-2.0.10-RC/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/LifecycleMapping.java:680477
+/maven/components/branches/maven-2.0.x/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/LifecycleMapping.java:679206,708871,720042,726541,727548,727998,728264,728940,729060,729738,729785,730631
+/maven/components/branches/maven-2.1.x/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/LifecycleMapping.java:739385,741841,747468,748815,749612
+/maven/components/branches/sisbell-plugin-manager/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/LifecycleMapping.java:738973-739966
+/maven/components/sisbell-plugin-manager/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/LifecycleMapping.java:738757-738972
+/maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/mapping/LifecycleMapping.java:688587-696625,696644-699681

Modified: 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL: 
http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=757141&r1=757140&r2=757141&view=diff
==============================================================================
--- 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
 (original)
+++ 
maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
 Sun Mar 22 07:39:57 2009
@@ -162,30 +162,19 @@
         {
             return pluginDescriptor;
         }
-                
+                        
         try
         {            
-            String pluginVersion = plugin.getVersion();
-
-            logger.debug( "Resolving plugin: " + plugin.getKey() + " with 
version: " + pluginVersion );
-            
-            if ( ( pluginVersion == null ) || Artifact.LATEST_VERSION.equals( 
pluginVersion ) || Artifact.RELEASE_VERSION.equals( pluginVersion ) )
-            {
-                logger.debug( "Resolving version for plugin: " + 
plugin.getKey() );
-                
-                pluginVersion = resolvePluginVersion( plugin.getGroupId(), 
plugin.getArtifactId(), project, session );
-                
-                plugin.setVersion( pluginVersion );
-
-                logger.debug( "Resolved to version: " + pluginVersion );
-            }
-                         
+            resolvePluginVersion( plugin, project, session );
+                                     
             addPlugin( plugin, project, session );
             
-            // This does not appear to be caching anything really.
             pluginDescriptor = pluginCollector.getPluginDescriptor( plugin );
                         
             project.addPlugin( plugin );
+           
+            System.out.println( "AAA loading plugin " + 
pluginDescriptor.getArtifactId() + ":" + pluginDescriptor.getVersion() );       
 
+            System.out.println( "BBB realm: " + 
pluginDescriptor.getClassRealm() );
             
             return pluginDescriptor;
         }
@@ -732,6 +721,7 @@
         PluginDescriptor pluginDescriptor = 
mojoDescriptor.getPluginDescriptor();
 
         ClassRealm pluginRealm = pluginDescriptor.getClassRealm();
+        System.out.println( "XXX Looking for class realm " + 
pluginDescriptor.getArtifactId() + ":" + pluginDescriptor.getVersion() );
         
         // We are forcing the use of the plugin realm for all lookups that 
might occur during
         // the lifecycle that is part of the lookup. Here we are specifically 
trying to keep
@@ -1489,20 +1479,29 @@
         return ModelMarshaller.unmarshalModelPropertiesToXml( modelProperties, 
ProjectUri.baseUri );
     }
 
-    public String resolvePluginVersion( String groupId, String artifactId, 
MavenProject project, MavenSession session )
+    public void resolvePluginVersion( Plugin plugin, MavenProject project, 
MavenSession session )
         throws PluginVersionResolutionException, InvalidPluginException, 
PluginVersionNotFoundException
-    {
-        String version = null;
+    {        
+        String version = plugin.getVersion();
+        
+        if ( version != null && !Artifact.RELEASE_VERSION.equals( version ) )
+        {
+            return;
+        }
+        
+        String groupId = plugin.getGroupId();
         
+        String artifactId = plugin.getArtifactId();        
+                
         if ( project.getBuildPlugins() != null )
         {
             for ( Iterator it = project.getBuildPlugins().iterator(); 
it.hasNext() && ( version == null ); )
             {
-                Plugin plugin = (Plugin) it.next();
+                Plugin p = (Plugin) it.next();
 
-                if ( groupId.equals( plugin.getGroupId() ) && 
artifactId.equals( plugin.getArtifactId() ) )
+                if ( groupId.equals( p.getGroupId() ) && artifactId.equals( 
p.getArtifactId() ) )
                 {
-                    version = plugin.getVersion();
+                    version = p.getVersion();
                 }
             }
         }
@@ -1522,7 +1521,7 @@
             throw new PluginVersionNotFoundException( groupId, artifactId );
         }
 
-        return version;        
+        plugin.setVersion( version );
     }
 
     public String resolveReportPluginVersion( String groupId, String 
artifactId, MavenProject project, MavenSession session )
@@ -1616,6 +1615,7 @@
 
         ArtifactRepository localRepository = session.getLocalRepository();
 
+        // We need the POM for the actually plugin project so we can look at 
the prerequisite element.
         MavenProject pluginProject = buildPluginProject( plugin, 
localRepository, project.getRemoteArtifactRepositories() );
 
         Artifact pluginArtifact = repositorySystem.createPluginArtifact( 
plugin );
@@ -1819,5 +1819,5 @@
         {
             throw new PluginLoaderException( plugin, "Failed to load plugin. 
Reason: " + e.getMessage(), e );
         }
-    }    
+    }
 }

Modified: 
maven/components/branches/MNG-2766/maven-core/src/main/resources/META-INF/plexus/artifact-handlers.xml
URL: 
http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/resources/META-INF/plexus/artifact-handlers.xml?rev=757141&r1=757140&r2=757141&view=diff
==============================================================================
--- 
maven/components/branches/MNG-2766/maven-core/src/main/resources/META-INF/plexus/artifact-handlers.xml
 (original)
+++ 
maven/components/branches/MNG-2766/maven-core/src/main/resources/META-INF/plexus/artifact-handlers.xml
 Sun Mar 22 07:39:57 2009
@@ -25,22 +25,18 @@
       </configuration>
     </component>     
     <component>
-      <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+      <role>org.apache.maven.lifecycle.LifecycleMapping</role>
       <role-hint>pom</role-hint>
-      
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+      
<implementation>org.apache.maven.lifecycle.DefaultLifecycleMapping</implementation>
       <configuration>
         <lifecycles>
           <lifecycle>
             <id>default</id>
             <!-- START SNIPPET: pom-lifecycle -->
             <phases>
-              
<package>org.apache.maven.plugins:maven-site-plugin:attach-descriptor</package>
               
<install>org.apache.maven.plugins:maven-install-plugin:install</install>
               
<deploy>org.apache.maven.plugins:maven-deploy-plugin:deploy</deploy>
             </phases>
-            <optional-mojos>
-              
<optional-mojo>org.apache.maven.plugins:maven-site-plugin:attach-descriptor</optional-mojo>
-            </optional-mojos>
             <!-- END SNIPPET: pom-lifecycle -->
           </lifecycle>
         </lifecycles>
@@ -62,9 +58,9 @@
       </configuration>
     </component>
     <component>
-      <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+      <role>org.apache.maven.lifecycle.LifecycleMapping</role>
       <role-hint>jar</role-hint>
-      
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+      
<implementation>org.apache.maven.lifecycle.DefaultLifecycleMapping</implementation>
       <configuration>
         <lifecycles>
           <lifecycle>
@@ -73,9 +69,7 @@
             <phases>
               
<process-resources>org.apache.maven.plugins:maven-resources-plugin:resources</process-resources>
               
<compile>org.apache.maven.plugins:maven-compiler-plugin:compile</compile>
-              <process-test-resources>
-                org.apache.maven.plugins:maven-resources-plugin:testResources
-              </process-test-resources>
+              
<process-test-resources>org.apache.maven.plugins:maven-resources-plugin:testResources</process-test-resources>
               
<test-compile>org.apache.maven.plugins:maven-compiler-plugin:testCompile</test-compile>
               <test>org.apache.maven.plugins:maven-surefire-plugin:test</test>
               <package>
@@ -106,10 +100,10 @@
       </configuration>
     </component>
     <component>
-      <role>org.apache.maven.lifecycle.mapping.LifecycleMapping
+      <role>org.apache.maven.lifecycle.LifecycleMapping
       </role>
       <role-hint>ejb</role-hint>
-      
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping
+      <implementation>org.apache.maven.lifecycle.DefaultLifecycleMapping
       </implementation>
       <configuration>
         <lifecycles>
@@ -168,9 +162,9 @@
       </configuration>
     </component>   
     <component>
-      <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+      <role>org.apache.maven.lifecycle.LifecycleMapping</role>
       <role-hint>ejb3</role-hint>
-      
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+      
<implementation>org.apache.maven.lifecycle.DefaultLifecycleMapping</implementation>
       <configuration>
         <!-- START SNIPPET: ejb3-lifecycle -->
         <phases>
@@ -223,9 +217,9 @@
       </configuration>
     </component>
     <component>
-      <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+      <role>org.apache.maven.lifecycle.LifecycleMapping</role>
       <role-hint>maven-plugin</role-hint>
-      
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+      
<implementation>org.apache.maven.lifecycle.DefaultLifecycleMapping</implementation>
       <configuration>
         <lifecycles>
           <lifecycle>
@@ -308,9 +302,9 @@
       </configuration>
     </component>
     <component>
-      <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+      <role>org.apache.maven.lifecycle.LifecycleMapping</role>
       <role-hint>war</role-hint>
-      
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+      
<implementation>org.apache.maven.lifecycle.DefaultLifecycleMapping</implementation>
       <configuration>
         <lifecycles>
           <lifecycle>
@@ -350,9 +344,9 @@
       </configuration>
     </component>
     <component>
-      <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+      <role>org.apache.maven.lifecycle.LifecycleMapping</role>
       <role-hint>ear</role-hint>
-      
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+      
<implementation>org.apache.maven.lifecycle.DefaultLifecycleMapping</implementation>
       <configuration>
         <lifecycles>
           <lifecycle>
@@ -389,9 +383,9 @@
       </configuration>
     </component>
     <component>
-      <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+      <role>org.apache.maven.lifecycle.LifecycleMapping</role>
       <role-hint>rar</role-hint>
-      
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+      
<implementation>org.apache.maven.lifecycle.DefaultLifecycleMapping</implementation>
       <configuration>
         <lifecycles>
           <lifecycle>
@@ -431,9 +425,9 @@
       </configuration>
     </component>
     <component>
-      <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role>
+      <role>org.apache.maven.lifecycle.LifecycleMapping</role>
       <role-hint>par</role-hint>
-      
<implementation>org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping</implementation>
+      
<implementation>org.apache.maven.lifecycle.DefaultLifecycleMapping</implementation>
       <configuration>
         <!-- START SNIPPET: par-lifecycle -->
         <phases>

Modified: 
maven/components/branches/MNG-2766/maven-core/src/main/resources/META-INF/plexus/components.xml
URL: 
http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/resources/META-INF/plexus/components.xml?rev=757141&r1=757140&r2=757141&view=diff
==============================================================================
--- 
maven/components/branches/MNG-2766/maven-core/src/main/resources/META-INF/plexus/components.xml
 (original)
+++ 
maven/components/branches/MNG-2766/maven-core/src/main/resources/META-INF/plexus/components.xml
 Sun Mar 22 07:39:57 2009
@@ -37,6 +37,10 @@
         <requirement>
           <role>org.apache.maven.plugin.PluginManager</role>
         </requirement>
+        <requirement>
+          <role>org.apache.maven.lifecycle.LifecycleMapping</role>
+          <field-name>lifecycleMappings</field-name>
+        </requirement>
       </requirements>
       <configuration>
         <lifecycles>

Modified: 
maven/components/branches/MNG-2766/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java
URL: 
http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java?rev=757141&r1=757140&r2=757141&view=diff
==============================================================================
--- 
maven/components/branches/MNG-2766/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java
 (original)
+++ 
maven/components/branches/MNG-2766/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java
 Sun Mar 22 07:39:57 2009
@@ -1,7 +1,9 @@
 package org.apache.maven.lifecycle;
 
 import java.io.File;
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.List;
 import java.util.Properties;
 
 import org.apache.maven.artifact.InvalidRepositoryException;
@@ -9,7 +11,12 @@
 import org.apache.maven.execution.DefaultMavenExecutionRequest;
 import org.apache.maven.execution.MavenExecutionRequest;
 import org.apache.maven.execution.MavenSession;
+import org.apache.maven.execution.ReactorManager;
 import org.apache.maven.model.Repository;
+import org.apache.maven.monitor.event.DefaultEventMonitor;
+import org.apache.maven.monitor.event.DeprecationEventDispatcher;
+import org.apache.maven.monitor.event.EventDispatcher;
+import org.apache.maven.monitor.event.MavenEvents;
 import org.apache.maven.plugin.MavenPluginCollector;
 import org.apache.maven.plugin.MavenPluginDiscoverer;
 import org.apache.maven.plugin.MojoExecution;
@@ -24,6 +31,7 @@
 import org.codehaus.plexus.ContainerConfiguration;
 import org.codehaus.plexus.PlexusTestCase;
 import org.codehaus.plexus.component.annotations.Requirement;
+import org.codehaus.plexus.logging.console.ConsoleLogger;
 import org.codehaus.plexus.util.FileUtils;
 
 public class LifecycleExecutorTest
@@ -41,6 +49,9 @@
     @Requirement
     private DefaultLifecycleExecutor lifecycleExecutor;
 
+    File pom;
+    File targetPom;
+    
     protected void setUp()
         throws Exception
     {
@@ -48,6 +59,13 @@
         repositorySystem = lookup( RepositorySystem.class );
         pluginManager = lookup( PluginManager.class );
         lifecycleExecutor = (DefaultLifecycleExecutor) lookup( 
LifecycleExecutor.class );
+        targetPom = new File( getBasedir(), 
"target/lifecycle-executor/pom-plugin.xml" );
+
+        if ( !targetPom.exists() )
+        {
+            pom = new File( getBasedir(), "src/test/pom.xml" );
+            FileUtils.copyFile( pom, targetPom );
+        }
     }
 
     public void testLifecyclePhases()
@@ -55,7 +73,7 @@
         assertNotNull( lifecycleExecutor.getLifecyclePhases() );
     }
 
-    public void testRemoteResourcesPlugin()
+    public void testStandardLifecycle()
         throws Exception
     {
         // - find the plugin [extension point: any client may wish to do 
whatever they choose]
@@ -63,10 +81,55 @@
         // - configure the plugin [extension point]
         // - execute the plugin    
 
-        // Our test POM and this is actually the Maven POM so not the best 
idea.
-        File pom = new File( getBasedir(), "src/test/pom.xml" );
-        File targetPom = new File( getBasedir(), 
"target/lifecycle-executor/pom-plugin.xml" );
-        FileUtils.copyFile( pom, targetPom );
+        if ( !targetPom.getParentFile().exists() )
+        {
+            targetPom.getParentFile().mkdirs();
+        }
+
+        ArtifactRepository localRepository = getLocalRepository();
+
+        Repository repository = new Repository();
+        repository.setUrl( "http://repo1.maven.org/maven2"; );
+        repository.setId( "central" );
+
+        ProjectBuilderConfiguration configuration = new 
DefaultProjectBuilderConfiguration()
+            .setLocalRepository( localRepository )
+            .setRemoteRepositories( Arrays.asList( 
repositorySystem.buildArtifactRepository( repository ) ) );
+
+        MavenProject project = projectBuilder.build( targetPom, configuration 
);
+        assertEquals( "maven", project.getArtifactId() );
+        assertEquals( "3.0-SNAPSHOT", project.getVersion() );
+
+        MavenExecutionRequest request = new DefaultMavenExecutionRequest()
+            .setProjectPresent( true )
+            .setPluginGroups( Arrays.asList( new String[] { 
"org.apache.maven.plugins" } ) )
+            .setLocalRepository( localRepository )
+            .setRemoteRepositories( Arrays.asList( 
repositorySystem.buildArtifactRepository( repository ) ) )
+            .setGoals( Arrays.asList( new String[] { "package" } ) )    
+            .addEventMonitor( new DefaultEventMonitor( new ConsoleLogger( 0, 
"" ) ) )
+            .setProperties( new Properties() );
+
+        List projects = new ArrayList();
+        projects.add( project );
+        
+        ReactorManager reactorManager = new ReactorManager( projects, 
request.getReactorFailureBehavior() );
+        
+        MavenSession session = new MavenSession( getContainer(), request, 
reactorManager );
+        //!!jvz This is not really quite right, take a look at how this 
actually works.
+        session.setCurrentProject( project );
+                
+        EventDispatcher dispatcher = new DeprecationEventDispatcher( 
MavenEvents.DEPRECATIONS, request.getEventMonitors() );
+                
+        lifecycleExecutor.execute( session, reactorManager, dispatcher );
+    }
+    
+    public void testRemoteResourcesPlugin()
+        throws Exception
+    {
+        // - find the plugin [extension point: any client may wish to do 
whatever they choose]
+        // - load the plugin into a classloader [extension point: we want to 
take them from a repository, some may take from disk or whatever]
+        // - configure the plugin [extension point]
+        // - execute the plugin    
 
         if ( !targetPom.getParentFile().exists() )
         {
@@ -119,11 +182,6 @@
         // - configure the plugin [extension point]
         // - execute the plugin    
 
-        // Our test POM and this is actually the Maven POM so not the best 
idea.
-        File pom = new File( getBasedir(), "src/test/pom.xml" );
-        File targetPom = new File( getBasedir(), 
"target/lifecycle-executor/pom-plugin.xml" );
-        FileUtils.copyFile( pom, targetPom );
-
         if ( !targetPom.getParentFile().exists() )
         {
             targetPom.getParentFile().mkdirs();

Modified: 
maven/components/branches/MNG-2766/maven-project/src/main/java/org/apache/maven/project/MavenProject.java
URL: 
http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-project/src/main/java/org/apache/maven/project/MavenProject.java?rev=757141&r1=757140&r2=757141&view=diff
==============================================================================
--- 
maven/components/branches/MNG-2766/maven-project/src/main/java/org/apache/maven/project/MavenProject.java
 (original)
+++ 
maven/components/branches/MNG-2766/maven-project/src/main/java/org/apache/maven/project/MavenProject.java
 Sun Mar 22 07:39:57 2009
@@ -124,8 +124,6 @@
 
     private List<String> scriptSourceRoots = new ArrayList<String>();
 
-    private List<ArtifactRepository> pluginArtifactRepositories;
-
     private ArtifactRepository releaseArtifactRepository;
 
     private ArtifactRepository snapshotArtifactRepository;
@@ -166,7 +164,6 @@
     private ProjectBuilderConfiguration projectBuilderConfiguration;
 
     private RepositorySystem repositorySystem;
-    //
 
     private File parentFile;
 
@@ -1350,7 +1347,6 @@
 
     public void setPluginArtifactRepositories( List<ArtifactRepository> 
pluginArtifactRepositories )
     {
-        this.pluginArtifactRepositories = pluginArtifactRepositories;
     }
 
     /**


Reply via email to