You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jv...@apache.org on 2009/04/28 23:20:37 UTC

svn commit: r769547 - in /maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle: DefaultLifecycleExecutor.java LifecycleExecutor.java

Author: jvanzyl
Date: Tue Apr 28 21:20:36 2009
New Revision: 769547

URL: http://svn.apache.org/viewvc?rev=769547&view=rev
Log:
o adding in all plugins in all the default lifecycles

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/LifecycleExecutor.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=769547&r1=769546&r2=769547&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 Tue Apr 28 21:20:36 2009
@@ -193,25 +193,42 @@
         }         
     }
       
-    public Set<Plugin> lifecyclePlugins( String lifecycleId, String packaging )
+    public Set<Plugin> lifecyclePlugins( String packaging )
     {
         Set<Plugin> plugins = new LinkedHashSet<Plugin>();
         
-        Lifecycle lifecycle = lifecycleMap.get( lifecycleId );                
-                
-        LifecycleMapping lifecycleMappingForPackaging = lifecycleMappings.get( packaging );
-          
-        Map<String, String> lifecyclePhasesForPackaging = lifecycleMappingForPackaging.getLifecycles().get( lifecycleId ).getPhases();            
-        
-        for ( String s : lifecyclePhasesForPackaging.values() )
+        for ( Lifecycle lifecycle : lifecycles )
         {
-            String[] p = StringUtils.split( s, ":" );
-            Plugin plugin = new Plugin();        
-            plugin.setGroupId( p[0] );
-            plugin.setArtifactId( p[1] );
-            plugins.add( plugin );
+            LifecycleMapping lifecycleMappingForPackaging = lifecycleMappings.get( packaging );
+
+            org.apache.maven.lifecycle.mapping.Lifecycle lifecycleConfiguration = lifecycleMappingForPackaging.getLifecycles().get( lifecycle.getId() );                                                           
+            
+            if ( lifecycleConfiguration != null )
+            {
+                Map<String, String> lifecyclePhasesForPackaging = lifecycleConfiguration.getPhases();
+
+                for ( String s : lifecyclePhasesForPackaging.values() )
+                {
+                    String[] p = StringUtils.split( s, ":" );
+                    Plugin plugin = new Plugin();
+                    plugin.setGroupId( p[0] );
+                    plugin.setArtifactId( p[1] );
+                    plugins.add( plugin );
+                }
+            }
+            else if ( lifecycle.getDefaultPhases() != null )
+            {
+                for ( String s : lifecycle.getDefaultPhases() )
+                {
+                    String[] p = StringUtils.split( s, ":" );
+                    Plugin plugin = new Plugin();
+                    plugin.setGroupId( p[0] );
+                    plugin.setArtifactId( p[1] );
+                    plugins.add( plugin );
+                }                
+            }        
         }
-        
+
         return plugins;
     }        
     
@@ -308,8 +325,7 @@
                     {
                         String s = plugin.getGroupId() + ":" + plugin.getArtifactId() + ":" + plugin.getVersion() + ":" + goal;
                         phaseToMojoMapping.get( execution.getPhase() ).add( s );
-                    }
-                    
+                    }                    
                 }                
                 // if not then i need to grab the mojo descriptor and look at
                 // the phase that is specified

Modified: maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java
URL: http://svn.apache.org/viewvc/maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java?rev=769547&r1=769546&r2=769547&view=diff
==============================================================================
--- maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java (original)
+++ maven/components/branches/MNG-2766/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java Tue Apr 28 21:20:36 2009
@@ -25,6 +25,7 @@
 import org.apache.maven.BuildFailureException;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.model.Plugin;
+import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
 import org.apache.maven.project.MavenProject;
@@ -47,8 +48,8 @@
     List<MojoDescriptor> calculateLifecyclePlan( String lifecyclePhase, MavenSession session )
         throws LifecycleExecutionException;
         
-    Set<Plugin> lifecyclePlugins( String lifecycleId, String packaging );
+    Set<Plugin> lifecyclePlugins( String packaging );
     
     void execute( MavenSession session )
-        throws LifecycleExecutionException, MojoFailureException;
+        throws LifecycleExecutionException, MojoFailureException, MojoExecutionException;
 }