You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2005/09/24 07:24:21 UTC

svn commit: r291251 - in /maven/components/trunk/maven-core/src/main/java/org/apache/maven: lifecycle/DefaultLifecycleExecutor.java plugin/DefaultPluginManager.java

Author: brett
Date: Fri Sep 23 22:24:15 2005
New Revision: 291251

URL: http://svn.apache.org/viewcvs?rev=291251&view=rev
Log:
no root project in reactor

Modified:
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=291251&r1=291250&r2=291251&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java Fri Sep 23 22:24:15 2005
@@ -172,8 +172,8 @@
         return response;
     }
 
-    private void executeTaskSegments( List taskSegments, ReactorManager rm, MavenSession session, MavenProject project,
-                                      EventDispatcher dispatcher )
+    private void executeTaskSegments( List taskSegments, ReactorManager rm, MavenSession session,
+                                      MavenProject rootProject, EventDispatcher dispatcher )
         throws PluginNotFoundException, MojoExecutionException, ArtifactResolutionException, LifecycleExecutionException
     {
         for ( Iterator it = taskSegments.iterator(); it.hasNext(); )
@@ -182,11 +182,11 @@
 
             if ( segment.aggregate() )
             {
-                if ( !rm.isBlackListed( project ) )
+                if ( !rm.isBlackListed( rootProject ) )
                 {
                     line();
 
-                    getLogger().info( "Building " + project.getName() );
+                    getLogger().info( "Building " + rootProject.getName() );
 
                     getLogger().info( "  " + segment );
 
@@ -196,7 +196,7 @@
                     // Event monitoring.
                     String event = MavenEvents.PROJECT_EXECUTION;
 
-                    dispatcher.dispatchStart( event, project.getId() + " ( " + segment + " )" );
+                    dispatcher.dispatchStart( event, rootProject.getId() + " ( " + segment + " )" );
 
                     try
                     {
@@ -207,23 +207,23 @@
 
                             try
                             {
-                                executeGoal( task, session, project );
+                                executeGoal( task, session, rootProject );
                             }
                             catch ( MojoExecutionException e )
                             {
-                                handleExecutionFailure( rm, project, e, task );
+                                handleExecutionFailure( rm, rootProject, e, task );
                             }
                             catch ( ArtifactResolutionException e )
                             {
-                                handleExecutionFailure( rm, project, e, task );
+                                handleExecutionFailure( rm, rootProject, e, task );
                             }
                         }
 
-                        dispatcher.dispatchEnd( event, project.getId() + " ( " + segment + " )" );
+                        dispatcher.dispatchEnd( event, rootProject.getId() + " ( " + segment + " )" );
                     }
                     catch ( LifecycleExecutionException e )
                     {
-                        dispatcher.dispatchError( event, project.getId() + " ( " + segment + " )", e );
+                        dispatcher.dispatchError( event, rootProject.getId() + " ( " + segment + " )", e );
 
                         throw e;
                     }
@@ -232,7 +232,7 @@
                 {
                     line();
 
-                    getLogger().info( "SKIPPING " + project.getName() );
+                    getLogger().info( "SKIPPING " + rootProject.getName() );
 
                     getLogger().info( "  " + segment );
 
@@ -279,11 +279,11 @@
                                 }
                                 catch ( MojoExecutionException e )
                                 {
-                                    handleExecutionFailure( rm, project, e, task );
+                                    handleExecutionFailure( rm, currentProject, e, task );
                                 }
                                 catch ( ArtifactResolutionException e )
                                 {
-                                    handleExecutionFailure( rm, project, e, task );
+                                    handleExecutionFailure( rm, currentProject, e, task );
                                 }
                             }
 
@@ -349,55 +349,19 @@
     {
         List segments = new ArrayList();
 
-        TaskSegment currentSegment = null;
-        for ( Iterator it = tasks.iterator(); it.hasNext(); )
+        if ( project != null )
         {
-            String task = (String) it.next();
 
-            // if it's a phase, then we don't need to check whether it's an aggregator.
-            // simply add it to the current task partition.
-            if ( phases.contains( task ) )
+            TaskSegment currentSegment = null;
+            for ( Iterator it = tasks.iterator(); it.hasNext(); )
             {
-                if ( currentSegment != null && currentSegment.aggregate() )
-                {
-                    segments.add( currentSegment );
-                    currentSegment = null;
-                }
+                String task = (String) it.next();
 
-                if ( currentSegment == null )
-                {
-                    currentSegment = new TaskSegment();
-                }
-
-                currentSegment.add( task );
-            }
-            else
-            {
-                MojoDescriptor mojo = null;
-                try
-                {
-                    // definitely a CLI goal, can use prefix
-                    mojo = getMojoDescriptor( task, session, project, task, true );
-                }
-                catch ( LifecycleExecutionException e )
+                // if it's a phase, then we don't need to check whether it's an aggregator.
+                // simply add it to the current task partition.
+                if ( phases.contains( task ) )
                 {
-                    getLogger().info(
-                        "Cannot find mojo descriptor for: \'" + task + "\' - Treating as non-aggregator." );
-                    getLogger().debug( "", e );
-                }
-                catch ( ArtifactResolutionException e )
-                {
-                    getLogger().info(
-                        "Cannot find mojo descriptor for: \'" + task + "\' - Treating as non-aggregator." );
-                    getLogger().debug( "", e );
-                }
-
-                // if the mojo descriptor was found, determine aggregator status according to:
-                // 1. whether the mojo declares itself an aggregator
-                // 2. whether the mojo DOES NOT require a project to function (implicitly avoid reactor)
-                if ( mojo != null && ( mojo.isAggregator() || !mojo.isProjectRequired() ) )
-                {
-                    if ( currentSegment != null && !currentSegment.aggregate() )
+                    if ( currentSegment != null && currentSegment.aggregate() )
                     {
                         segments.add( currentSegment );
                         currentSegment = null;
@@ -405,30 +369,78 @@
 
                     if ( currentSegment == null )
                     {
-                        currentSegment = new TaskSegment( true );
+                        currentSegment = new TaskSegment();
                     }
 
                     currentSegment.add( task );
                 }
                 else
                 {
-                    if ( currentSegment != null && currentSegment.aggregate() )
+                    MojoDescriptor mojo = null;
+                    try
                     {
-                        segments.add( currentSegment );
-                        currentSegment = null;
+                        // definitely a CLI goal, can use prefix
+                        mojo = getMojoDescriptor( task, session, project, task, true );
+                    }
+                    catch ( LifecycleExecutionException e )
+                    {
+                        getLogger().info(
+                            "Cannot find mojo descriptor for: \'" + task + "\' - Treating as non-aggregator." );
+                        getLogger().debug( "", e );
+                    }
+                    catch ( ArtifactResolutionException e )
+                    {
+                        getLogger().info(
+                            "Cannot find mojo descriptor for: \'" + task + "\' - Treating as non-aggregator." );
+                        getLogger().debug( "", e );
                     }
 
-                    if ( currentSegment == null )
+                    // if the mojo descriptor was found, determine aggregator status according to:
+                    // 1. whether the mojo declares itself an aggregator
+                    // 2. whether the mojo DOES NOT require a project to function (implicitly avoid reactor)
+                    if ( mojo != null && ( mojo.isAggregator() || !mojo.isProjectRequired() ) )
                     {
-                        currentSegment = new TaskSegment();
+                        if ( currentSegment != null && !currentSegment.aggregate() )
+                        {
+                            segments.add( currentSegment );
+                            currentSegment = null;
+                        }
+
+                        if ( currentSegment == null )
+                        {
+                            currentSegment = new TaskSegment( true );
+                        }
+
+                        currentSegment.add( task );
                     }
+                    else
+                    {
+                        if ( currentSegment != null && currentSegment.aggregate() )
+                        {
+                            segments.add( currentSegment );
+                            currentSegment = null;
+                        }
 
-                    currentSegment.add( task );
+                        if ( currentSegment == null )
+                        {
+                            currentSegment = new TaskSegment();
+                        }
+
+                        currentSegment.add( task );
+                    }
                 }
             }
-        }
 
-        segments.add( currentSegment );
+            segments.add( currentSegment );
+        }
+        else
+        {
+            TaskSegment segment = new TaskSegment( false );
+            for ( Iterator i = tasks.iterator(); i.hasNext(); )
+            {
+                segment.add( (String) i.next() );
+            }
+        }
 
         return segments;
     }

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java?rev=291251&r1=291250&r2=291251&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java Fri Sep 23 22:24:15 2005
@@ -141,11 +141,8 @@
     {
         // TODO: since this is only used in the lifecycle executor, maybe it should be moved there? There is no other
         // use for the mapping manager in here
-        Settings settings = session.getSettings();
-        List pluginGroups = settings.getPluginGroups();
-        if ( pluginMappingManager == null ) throw new NullPointerException( "pluginMappingManager was null" );
-        if ( project == null ) throw new NullPointerException( "project was null" );
-        return pluginMappingManager.getByPrefix( prefix, pluginGroups, project.getPluginArtifactRepositories(),
+        return pluginMappingManager.getByPrefix( prefix, session.getSettings().getPluginGroups(),
+                                                 project.getPluginArtifactRepositories(),
                                                  session.getLocalRepository() );
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org