You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by br...@apache.org on 2005/10/13 18:37:24 UTC

svn commit: r320797 [1/2] - in /maven/components/trunk: maven-core/src/main/java/org/apache/maven/ maven-core/src/main/java/org/apache/maven/cli/ maven-core/src/main/java/org/apache/maven/execution/ maven-core/src/main/java/org/apache/maven/lifecycle/ ...

Author: brett
Date: Thu Oct 13 09:36:54 2005
New Revision: 320797

URL: http://svn.apache.org/viewcvs?rev=320797&view=rev
Log:
PR: MNG-122
final exception cleanup - reduce the noise in the lifecycle executor, get rid of response object in favour of exception handling from DefaultMaven.

Added:
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java   (with props)
Removed:
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionResponse.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/NoGoalsSpecifiedException.java
Modified:
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/BuildFailureException.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/Maven.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/BuildFailure.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/ReactorManager.java
    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/lifecycle/LifecycleExecutor.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionManager.java
    maven/components/trunk/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java
    maven/components/trunk/maven-plugins/maven-release-plugin/src/main/java/org/apache/maven/plugins/release/PrepareReleaseMojo.java

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/BuildFailureException.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/BuildFailureException.java?rev=320797&r1=320796&r2=320797&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/BuildFailureException.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/BuildFailureException.java Thu Oct 13 09:36:54 2005
@@ -25,8 +25,27 @@
 public class BuildFailureException
     extends Exception
 {
+    private String longMessage;
+
     public BuildFailureException( String message )
     {
         super( message );
+    }
+
+    public BuildFailureException( String message, String longMessage )
+    {
+        super( message );
+        this.longMessage = longMessage;
+    }
+
+    public BuildFailureException( String message, String longMessage, Throwable cause )
+    {
+        super( message, cause );
+        this.longMessage = longMessage;
+    }
+
+    public String getLongMessage()
+    {
+        return longMessage;
     }
 }

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java?rev=320797&r1=320796&r2=320797&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java Thu Oct 13 09:36:54 2005
@@ -18,11 +18,10 @@
 
 import org.apache.maven.artifact.manager.WagonManager;
 import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.artifact.versioning.DefaultArtifactVersion;
+import org.apache.maven.execution.BuildFailure;
 import org.apache.maven.execution.MavenExecutionRequest;
-import org.apache.maven.execution.MavenExecutionResponse;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.execution.ReactorManager;
 import org.apache.maven.execution.RuntimeInformation;
@@ -31,8 +30,6 @@
 import org.apache.maven.model.Profile;
 import org.apache.maven.monitor.event.EventDispatcher;
 import org.apache.maven.monitor.event.MavenEvents;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
 import org.apache.maven.profiles.ProfileManager;
 import org.apache.maven.profiles.activation.ProfileActivationException;
 import org.apache.maven.project.MavenProject;
@@ -71,14 +68,11 @@
 /**
  * @author <a href="mailto:jason@maven.org">Jason van Zyl </a>
  * @version $Id$
- * @todo unify error reporting. We should return one response, always - and let the CLI decide how to render it. The reactor response should contain individual project responses
  */
 public class DefaultMaven
     extends AbstractLogEnabled
     implements Maven, Contextualizable
 {
-    public static File userDir = new File( System.getProperty( "user.dir" ) );
-
     // ----------------------------------------------------------------------
     // Components
     // ----------------------------------------------------------------------
@@ -103,8 +97,103 @@
     // Project execution
     // ----------------------------------------------------------------------
 
-    public MavenExecutionResponse execute( MavenExecutionRequest request )
-        throws SettingsConfigurationException, MavenExecutionException
+    public void execute( MavenExecutionRequest request )
+        throws MavenExecutionException
+    {
+        EventDispatcher dispatcher = request.getEventDispatcher();
+
+        String event = MavenEvents.REACTOR_EXECUTION;
+
+        dispatcher.dispatchStart( event, request.getBaseDirectory() );
+
+        try
+        {
+            ReactorManager rm = doExecute( request, dispatcher );
+
+            // TODO: shoul all the logging be left to the CLI?
+            logReactorSummary( rm );
+
+            if ( rm.hasBuildFailures() )
+            {
+                logErrors( rm, request.isShowErrors() );
+            }
+            else
+            {
+                logSuccess( rm );
+            }
+
+            stats( request.getStartTime() );
+
+            line();
+
+            dispatcher.dispatchEnd( event, request.getBaseDirectory() );
+        }
+        catch ( LifecycleExecutionException e )
+        {
+            dispatcher.dispatchError( event, request.getBaseDirectory(), e );
+
+            logError( e, request.isShowErrors() );
+
+            stats( request.getStartTime() );
+
+            line();
+
+            throw new MavenExecutionException( e.getMessage(), e );
+        }
+        catch ( BuildFailureException e )
+        {
+            dispatcher.dispatchError( event, request.getBaseDirectory(), e );
+
+            logFailure( e, request.isShowErrors() );
+
+            stats( request.getStartTime() );
+
+            line();
+
+            throw new MavenExecutionException( e.getMessage(), e );
+        }
+        catch ( Throwable t )
+        {
+            dispatcher.dispatchError( event, request.getBaseDirectory(), t );
+
+            logFatal( t );
+
+            stats( request.getStartTime() );
+
+            line();
+
+            throw new MavenExecutionException( "Error executing project within the reactor", t );
+        }
+    }
+
+    private void logErrors( ReactorManager rm, boolean showErrors )
+    {
+        for ( Iterator it = rm.getSortedProjects().iterator(); it.hasNext(); )
+        {
+            MavenProject project = (MavenProject) it.next();
+
+            if ( rm.hasBuildFailure( project ) )
+            {
+                BuildFailure buildFailure = rm.getBuildFailure( project );
+
+                line();
+
+                getLogger().info(
+                    "Error for project: " + project.getName() + " (during " + buildFailure.getTask() + ")" );
+
+                line();
+
+                logDiagnostics( buildFailure.getCause() );
+
+                logTrace( buildFailure.getCause(), showErrors );
+
+                line();
+            }
+        }
+    }
+
+    private ReactorManager doExecute( MavenExecutionRequest request, EventDispatcher dispatcher )
+        throws MavenExecutionException, BuildFailureException, LifecycleExecutionException
     {
         if ( request.getSettings().isOffline() )
         {
@@ -147,12 +236,10 @@
         {
             throw new MavenExecutionException( "Unable to configure Maven for execution", e );
         }
-
-        EventDispatcher dispatcher = request.getEventDispatcher();
-
-        String event = MavenEvents.REACTOR_EXECUTION;
-
-        dispatcher.dispatchStart( event, request.getBaseDirectory() );
+        catch ( SettingsConfigurationException e )
+        {
+            throw new MavenExecutionException( "Unable to configure Maven for execution", e );
+        }
 
         ProfileManager globalProfileManager = request.getGlobalProfileManager();
 
@@ -161,44 +248,11 @@
         getLogger().info( "Scanning for projects..." );
 
         boolean foundProjects = true;
-        List projects;
-        try
-        {
-            List files = getProjectFiles( request );
-
-            projects = collectProjects( files, request.getLocalRepository(), request.isRecursive(),
-                                        request.getSettings(), globalProfileManager, !request.isReactorActive() );
-
-            // the reasoning here is that the list is still unsorted according to dependency, so the first project
-            // SHOULD BE the top-level, or the one we want to start with if we're doing an aggregated build.
-
-            if ( projects.isEmpty() )
-            {
-                MavenProject superProject = projectBuilder.buildStandaloneSuperProject( request.getLocalRepository() );
-                projects.add( superProject );
-
-                foundProjects = false;
-            }
-        }
-        catch ( IOException e )
-        {
-            throw new MavenExecutionException( "Error processing projects for the reactor: ", e );
-        }
-        catch ( ArtifactResolutionException e )
+        List projects = getProjects( request, globalProfileManager );
+        if ( projects.isEmpty() )
         {
-            return dispatchErrorResponse( dispatcher, event, request.getBaseDirectory(), e );
-        }
-        catch ( ProjectBuildingException e )
-        {
-            return dispatchErrorResponse( dispatcher, event, request.getBaseDirectory(), e );
-        }
-        catch ( ProfileActivationException e )
-        {
-            return dispatchErrorResponse( dispatcher, event, request.getBaseDirectory(), e );
-        }
-        catch ( BuildFailureException e )
-        {
-            return dispatchErrorResponse( dispatcher, event, request.getBaseDirectory(), e );
+            projects.add( getSuperProject( request ) );
+            foundProjects = false;
         }
 
         ReactorManager rm;
@@ -215,7 +269,8 @@
         }
         catch ( CycleDetectedException e )
         {
-            return dispatchErrorResponse( dispatcher, event, request.getBaseDirectory(), e );
+            throw new MavenExecutionException(
+                "The projects in the reactor contain a cyclic reference: " + e.getMessage(), e );
         }
 
         if ( rm.hasMultipleProjects() )
@@ -233,113 +288,56 @@
 
         session.setUsingPOMsFromFilesystem( foundProjects );
 
-        try
-        {
-            MavenExecutionResponse response = lifecycleExecutor.execute( session, rm, dispatcher );
-
-            // TODO: is this perhaps more appropriate in the CLI?
-            if ( response.isExecutionFailure() )
-            {
-                dispatcher.dispatchError( event, request.getBaseDirectory(), response.getException() );
-
-                // TODO: yuck! Revisit when cleaning up the exception handling from the top down
-                Throwable exception = response.getException();
+        lifecycleExecutor.execute( session, rm, dispatcher );
 
-                // TODO: replace all handling by buildfailureexception/mavenexecutionexception or lifecycleexecutionexception
-                if ( exception instanceof BuildFailureException )
-                {
-                    logFailure( response, rm, exception, null );
-                }
-                else if ( exception instanceof MojoFailureException )
-                {
-                    MojoFailureException e = (MojoFailureException) exception;
-
-                    logFailure( response, rm, e, e.getLongMessage() );
-                }
-                else if ( exception instanceof MojoExecutionException )
-                {
-                    // TODO: replace by above
-                    if ( exception.getCause() == null )
-                    {
-                        MojoExecutionException e = (MojoExecutionException) exception;
-
-                        logFailure( response, rm, e, e.getLongMessage() );
-                    }
-                    else
-                    {
-                        // TODO: throw exceptions like this, so "failures" are just that
-                        logError( response );
-                    }
-                }
-                else if ( exception instanceof ArtifactNotFoundException )
-                {
-                    logFailure( response, rm, exception, null );
-                }
-                else
-                {
-                    // TODO: this should be a "FATAL" exception, reported to the
-                    // developers - however currently a LOT of
-                    // "user" errors fall through the cracks (like invalid POMs, as
-                    // one example)
-                    logError( response );
-                }
-            }
-            else
-            {
-                logSuccess( response, rm );
-            }
+        return rm;
+    }
 
-            dispatcher.dispatchEnd( event, request.getBaseDirectory() );
+    private MavenProject getSuperProject( MavenExecutionRequest request )
+        throws MavenExecutionException
+    {
+        MavenProject superProject;
+        try
+        {
+            superProject = projectBuilder.buildStandaloneSuperProject( request.getLocalRepository() );
 
-            return response;
         }
-        catch ( LifecycleExecutionException e )
+        catch ( ProjectBuildingException e )
         {
-            logFatal( e );
-
-            dispatcher.dispatchError( event, request.getBaseDirectory(), e );
-
-            throw new MavenExecutionException( "Error executing project within the reactor", e );
+            throw new MavenExecutionException( e.getMessage(), e );
         }
+        return superProject;
     }
 
-    private void writeReactorSummary( ReactorManager rm )
+    private List getProjects( MavenExecutionRequest request, ProfileManager globalProfileManager )
+        throws MavenExecutionException, BuildFailureException
     {
-        // -------------------------
-        // Reactor Summary:
-        // -------------------------
-        // o project-name...........FAILED
-        // o project2-name..........SKIPPED (dependency build failed or was skipped)
-        // o project-3-name.........SUCCESS
+        List projects;
+        try
+        {
+            List files = getProjectFiles( request );
 
-        line();
-        getLogger().info( "Reactor Summary:" );
-        line();
+            projects = collectProjects( files, request.getLocalRepository(), request.isRecursive(),
+                                        request.getSettings(), globalProfileManager, !request.isReactorActive() );
 
-        for ( Iterator it = rm.getSortedProjects().iterator(); it.hasNext(); )
+        }
+        catch ( IOException e )
         {
-            MavenProject project = (MavenProject) it.next();
-
-            if ( rm.hasBuildFailure( project ) )
-            {
-                logReactorSummaryLine( project.getName(), "FAILED", rm.getBuildFailure( project ).getTime() );
-            }
-            else if ( rm.isBlackListed( project ) )
-            {
-                logReactorSummaryLine( project.getName(), "SKIPPED (dependency build failed or was skipped)" );
-            }
-            else if ( rm.hasBuildSuccess( project ) )
-            {
-                logReactorSummaryLine( project.getName(), "SUCCESS", rm.getBuildSuccess( project ).getTime() );
-            }
-            else
-            {
-                logReactorSummaryLine( project.getName(), "NOT BUILT" );
-            }
+            throw new MavenExecutionException( "Error processing projects for the reactor: " + e.getMessage(), e );
         }
-
-        getLogger().info( "" );
-        getLogger().info( "" );
+        catch ( ArtifactResolutionException e )
+        {
+            throw new MavenExecutionException( e.getMessage(), e );
+        }
+        catch ( ProjectBuildingException e )
+        {
+            throw new MavenExecutionException( e.getMessage(), e );
+        }
+        catch ( ProfileActivationException e )
+        {
+            throw new MavenExecutionException( e.getMessage(), e );
+        }
+        return projects;
     }
 
     private void logReactorSummaryLine( String name, String status )
@@ -396,20 +394,6 @@
         return fmt.format( new Date( time ) );
     }
 
-    private MavenExecutionResponse dispatchErrorResponse( EventDispatcher dispatcher, String event,
-                                                          String baseDirectory, Exception e )
-    {
-        dispatcher.dispatchError( event, baseDirectory, e );
-
-        MavenExecutionResponse response = new MavenExecutionResponse();
-        response.setStart( new Date() );
-        response.setFinish( new Date() );
-        response.setException( e );
-        logError( response );
-
-        return response;
-    }
-
     private List collectProjects( List files, ArtifactRepository localRepository, boolean recursive, Settings settings,
                                   ProfileManager globalProfileManager, boolean isRoot )
         throws ArtifactResolutionException, ProjectBuildingException, ProfileActivationException,
@@ -606,134 +590,141 @@
     {
         line();
 
-        getLogger().error( "FATAL ERROR" );
+        getLogger().info( "FATAL ERROR" );
 
         line();
 
-        diagnoseError( error );
+        logDiagnostics( error );
 
-        line();
-
-        getLogger().error( "FATAL ERROR" );
-
-        line();
+        logTrace( error, true );
     }
 
-    protected void logError( MavenExecutionResponse r )
+    protected void logError( Exception e, boolean showErrors )
     {
         line();
 
-        getLogger().error( "BUILD ERROR" );
+        getLogger().info( "BUILD ERROR" );
 
         line();
 
-        diagnoseError( r.getException() );
+        logDiagnostics( e );
 
-        line();
-
-        getLogger().error( "BUILD ERROR" );
+        logTrace( e, showErrors );
+    }
 
+    protected void logFailure( BuildFailureException e, boolean showErrors )
+    {
         line();
 
-        stats( r.getStart(), r.getFinish() );
+        getLogger().info( "BUILD FAILURE" );
 
         line();
-    }
 
-    private void diagnoseError( Throwable error )
-    {
-        String message = null;
-        if ( errorDiagnostics != null )
-        {
-            message = errorDiagnostics.diagnose( error );
-        }
+        logDiagnostics( e );
 
-        if ( message == null )
+        if ( e.getLongMessage() != null )
         {
-            message = error.getMessage();
-        }
+            getLogger().info( e.getLongMessage() );
 
-        getLogger().info( "Diagnosis: " + message );
+            line();
+        }
 
-        line();
+        logTrace( e, showErrors );
+    }
 
-        // TODO: needs to honour -e
+    private void logTrace( Throwable t, boolean showErrors )
+    {
         if ( getLogger().isDebugEnabled() )
         {
-            getLogger().debug( "Trace:\n", error );
+            getLogger().debug( "Trace", t );
 
             line();
         }
+        else if ( showErrors )
+        {
+            getLogger().error( "Trace", t );
 
-    }
-
-    protected void logFailure( MavenExecutionResponse r, ReactorManager rm, Throwable error, String longMessage )
-    {
-        if ( rm.hasMultipleProjects() && r.executedMultipleProjects() )
+            line();
+        }
+        else
         {
-            writeReactorSummary( rm );
+            getLogger().info( "For more information, run Maven with the -e switch" );
         }
-        line();
-
-        getLogger().info( "BUILD FAILURE" );
-
-        line();
+    }
 
+    private void logDiagnostics( Throwable t )
+    {
         String message = null;
         if ( errorDiagnostics != null )
         {
-            message = errorDiagnostics.diagnose( error );
+            message = errorDiagnostics.diagnose( t );
         }
 
         if ( message == null )
         {
-            message = "Reason: " + error.getMessage();
+            message = t.getMessage();
         }
 
-        getLogger().info( message );
+        getLogger().error( message );
 
         line();
+    }
 
-        if ( longMessage != null )
-        {
-            getLogger().info( longMessage );
-
-            line();
-        }
-
-        // TODO: needs to honour -e
-        if ( getLogger().isDebugEnabled() )
-        {
-            getLogger().debug( "Trace", error );
-
-            line();
-        }
+    protected void logSuccess( ReactorManager rm )
+    {
+        line();
 
-        stats( r.getStart(), r.getFinish() );
+        getLogger().info( "BUILD SUCCESSFUL" );
 
         line();
     }
 
-    protected void logSuccess( MavenExecutionResponse r, ReactorManager rm )
+    private void logReactorSummary( ReactorManager rm )
     {
-        if ( rm.hasMultipleProjects() && r.executedMultipleProjects() )
+        if ( rm.hasMultipleProjects() && rm.executedMultipleProjects() )
         {
-            writeReactorSummary( rm );
-        }
-
-        line();
+            // -------------------------
+            // Reactor Summary:
+            // -------------------------
+            // o project-name...........FAILED
+            // o project2-name..........SKIPPED (dependency build failed or was skipped)
+            // o project-3-name.........SUCCESS
 
-        getLogger().info( "BUILD SUCCESSFUL" );
+            line();
+            getLogger().info( "Reactor Summary:" );
+            line();
 
-        line();
+            for ( Iterator it = rm.getSortedProjects().iterator(); it.hasNext(); )
+            {
+                MavenProject project = (MavenProject) it.next();
 
-        stats( r.getStart(), r.getFinish() );
+                if ( rm.hasBuildFailure( project ) )
+                {
+                    logReactorSummaryLine( project.getName(), "FAILED", rm.getBuildFailure( project ).getTime() );
+                }
+                else if ( rm.isBlackListed( project ) )
+                {
+                    logReactorSummaryLine( project.getName(), "SKIPPED (dependency build failed or was skipped)" );
+                }
+                else if ( rm.hasBuildSuccess( project ) )
+                {
+                    logReactorSummaryLine( project.getName(), "SUCCESS", rm.getBuildSuccess( project ).getTime() );
+                }
+                else
+                {
+                    logReactorSummaryLine( project.getName(), "NOT BUILT" );
+                }
+            }
 
-        line();
+            getLogger().info( "" );
+            getLogger().info( "" );
+        }
     }
 
-    protected void stats( Date start, Date finish )
+    protected void stats( Date start )
     {
+        Date finish = new Date();
+
         long time = finish.getTime() - start.getTime();
 
         getLogger().info( "Total time: " + formatTime( time ) );
@@ -793,6 +784,7 @@
     {
         List files = Collections.EMPTY_LIST;
 
+        File userDir = new File( System.getProperty( "user.dir" ) );
         if ( request.isReactorActive() )
         {
             // TODO: should we now include the pom.xml in the current directory?

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/Maven.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/Maven.java?rev=320797&r1=320796&r2=320797&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/Maven.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/Maven.java Thu Oct 13 09:36:54 2005
@@ -17,7 +17,6 @@
  */
 
 import org.apache.maven.execution.MavenExecutionRequest;
-import org.apache.maven.execution.MavenExecutionResponse;
 import org.apache.maven.reactor.MavenExecutionException;
 
 /**
@@ -32,6 +31,6 @@
 
     String RELEASE_POMv4 = "release-pom.xml";
 
-    MavenExecutionResponse execute( MavenExecutionRequest request )
-        throws MavenExecutionException, SettingsConfigurationException;
+    void execute( MavenExecutionRequest request )
+        throws MavenExecutionException;
 }

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java?rev=320797&r1=320796&r2=320797&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli/MavenCli.java Thu Oct 13 09:36:54 2005
@@ -33,7 +33,6 @@
 import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 import org.apache.maven.execution.DefaultMavenExecutionRequest;
 import org.apache.maven.execution.MavenExecutionRequest;
-import org.apache.maven.execution.MavenExecutionResponse;
 import org.apache.maven.execution.ReactorManager;
 import org.apache.maven.monitor.event.DefaultEventDispatcher;
 import org.apache.maven.monitor.event.DefaultEventMonitor;
@@ -218,7 +217,7 @@
             }
 
             request = createRequest( commandLine, settings, eventDispatcher, loggerManager, profileManager,
-                                     executionProperties );
+                                     executionProperties, showErrors );
 
             setProjectFileOptions( commandLine, request );
 
@@ -245,30 +244,16 @@
             }
         }
 
-        MavenExecutionResponse response;
         try
         {
-            response = maven.execute( request );
+            maven.execute( request );
         }
         catch ( MavenExecutionException e )
         {
-            showFatalError( "Error executing Maven for a project", e, showErrors );
-            return 1;
-        }
-        catch ( SettingsConfigurationException e )
-        {
-            showError( e.getMessage(), e, showErrors );
             return 1;
         }
 
-        if ( response != null && response.isExecutionFailure() )
-        {
-            return 1;
-        }
-        else
-        {
-            return 0;
-        }
+        return 0;
     }
 
     private static Settings buildSettings( CommandLine commandLine )
@@ -382,7 +367,8 @@
 
     private static MavenExecutionRequest createRequest( CommandLine commandLine, Settings settings,
                                                         EventDispatcher eventDispatcher, LoggerManager loggerManager,
-                                                        ProfileManager profileManager, Properties executionProperties )
+                                                        ProfileManager profileManager, Properties executionProperties,
+                                                        boolean showErrors )
         throws ComponentLookupException
     {
         MavenExecutionRequest request;
@@ -393,7 +379,7 @@
 
         request = new DefaultMavenExecutionRequest( localRepository, settings, eventDispatcher,
                                                     commandLine.getArgList(), userDir.getPath(), profileManager,
-                                                    executionProperties );
+                                                    executionProperties, showErrors );
 
         // TODO [BP]: do we set one per mojo? where to do it?
         Logger logger = loggerManager.getLoggerForComponent( Mojo.ROLE );

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/BuildFailure.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/BuildFailure.java?rev=320797&r1=320796&r2=320797&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/BuildFailure.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/BuildFailure.java Thu Oct 13 09:36:54 2005
@@ -37,12 +37,12 @@
         this.time = time;
     }
 
-    String getTask()
+    public String getTask()
     {
         return task;
     }
 
-    Exception getCause()
+    public Exception getCause()
     {
         return cause;
     }

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java?rev=320797&r1=320796&r2=320797&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java Thu Oct 13 09:36:54 2005
@@ -62,9 +62,12 @@
 
     private final Date startTime;
 
+    private final boolean showErrors;
+
     public DefaultMavenExecutionRequest( ArtifactRepository localRepository, Settings settings,
                                          EventDispatcher eventDispatcher, List goals, String baseDirectory,
-                                         ProfileManager globalProfileManager, Properties executionProperties )
+                                         ProfileManager globalProfileManager, Properties executionProperties,
+                                         boolean showErrors )
     {
         this.localRepository = localRepository;
 
@@ -81,6 +84,8 @@
         this.executionProperties = executionProperties;
 
         this.startTime = new Date();
+
+        this.showErrors = showErrors;
     }
 
     public Settings getSettings()
@@ -180,5 +185,10 @@
     public Date getStartTime()
     {
         return startTime;
+    }
+
+    public boolean isShowErrors()
+    {
+        return showErrors;
     }
 }

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java?rev=320797&r1=320796&r2=320797&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java Thu Oct 13 09:36:54 2005
@@ -69,4 +69,6 @@
     Properties getExecutionProperties();
 
     Date getStartTime();
+
+    boolean isShowErrors();
 }

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java?rev=320797&r1=320796&r2=320797&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenSession.java Thu Oct 13 09:36:54 2005
@@ -50,7 +50,7 @@
 
     private final String executionRootDir;
 
-    private boolean usingPOMsFromFilesystem;
+    private boolean usingPOMsFromFilesystem = true;
 
     private final Properties executionProperties;
 

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/ReactorManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/ReactorManager.java?rev=320797&r1=320796&r2=320797&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/ReactorManager.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/ReactorManager.java Thu Oct 13 09:36:54 2005
@@ -183,4 +183,8 @@
         return (BuildSuccess) buildSuccessesByProject.get( getProjectKey( project ) );
     }
 
+    public boolean executedMultipleProjects()
+    {
+        return buildFailuresByProject.size() + buildSuccessesByProject.size() > 1;
+    }
 }

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=320797&r1=320796&r2=320797&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 Thu Oct 13 09:36:54 2005
@@ -23,7 +23,6 @@
 import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
 import org.apache.maven.artifact.resolver.ArtifactResolutionException;
 import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
-import org.apache.maven.execution.MavenExecutionResponse;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.execution.ReactorManager;
 import org.apache.maven.extension.ExtensionManager;
@@ -47,6 +46,7 @@
 import org.apache.maven.plugin.descriptor.PluginDescriptor;
 import org.apache.maven.plugin.lifecycle.Execution;
 import org.apache.maven.plugin.lifecycle.Phase;
+import org.apache.maven.plugin.version.PluginVersionNotFoundException;
 import org.apache.maven.plugin.version.PluginVersionResolutionException;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.artifact.InvalidDependencyVersionException;
@@ -61,7 +61,6 @@
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
@@ -107,8 +106,8 @@
      * @param rm
      * @param dispatcher
      */
-    public MavenExecutionResponse execute( MavenSession session, ReactorManager rm, EventDispatcher dispatcher )
-        throws LifecycleExecutionException
+    public void execute( MavenSession session, ReactorManager rm, EventDispatcher dispatcher )
+        throws BuildFailureException, LifecycleExecutionException
     {
         // TODO: This is dangerous, particularly when it's just a collection of loose-leaf projects being built
         // within the same reactor (using an inclusion pattern to gather them up)...
@@ -125,65 +124,21 @@
             }
         }
 
-        MavenExecutionResponse response = new MavenExecutionResponse();
-
-        response.setStart( session.getStartTime() );
-
-        try
+        if ( goals.isEmpty() )
         {
-            if ( goals.isEmpty() )
-            {
-                // TODO: delete
-                throw new NoGoalsSpecifiedException( "You must specify at least one goal. Try 'install'" );
-            }
-
-            List taskSegments = segmentTaskListByAggregationNeeds( goals, session, rootProject );
+            throw new BuildFailureException( "You must specify at least one goal. Try 'install'" );
+        }
 
-            // TODO: probably don't want to do all this up front
-            findExtensions( session );
+        List taskSegments = segmentTaskListByAggregationNeeds( goals, session, rootProject );
 
-            executeTaskSegments( taskSegments, rm, session, rootProject, dispatcher, response );
+        // TODO: probably don't want to do all this up front
+        findExtensions( session );
 
-            if ( ReactorManager.FAIL_AT_END.equals( rm.getFailureBehavior() ) && rm.hasBuildFailures() )
-            {
-                response.setException( new BuildFailureException( "One or more projects failed to build." ) );
-            }
-        }
-        catch ( MojoExecutionException e )
-        {
-            response.setException( e );
-        }
-        catch ( ArtifactNotFoundException e )
-        {
-            response.setException( e );
-        }
-        catch ( ArtifactResolutionException e )
-        {
-            response.setException( e );
-        }
-        catch ( NoGoalsSpecifiedException e )
-        {
-            response.setException( e );
-        }
-        catch ( MojoFailureException e )
-        {
-            response.setException( e );
-        }
-        catch ( PluginNotFoundException e )
-        {
-            response.setException( e );
-        }
-        finally
-        {
-            response.setFinish( new Date() );
-        }
-
-        return response;
+        executeTaskSegments( taskSegments, rm, session, rootProject, dispatcher );
     }
 
     private void findExtensions( MavenSession session )
-        throws ArtifactNotFoundException, ArtifactResolutionException, LifecycleExecutionException,
-        PluginNotFoundException
+        throws LifecycleExecutionException
     {
         for ( Iterator i = session.getSortedProjects().iterator(); i.hasNext(); )
         {
@@ -200,18 +155,31 @@
                 {
                     throw new LifecycleExecutionException( "Unable to initialise extensions", e );
                 }
+                catch ( ArtifactResolutionException e )
+                {
+                    throw new LifecycleExecutionException( e.getMessage(), e );
+                }
+                catch ( ArtifactNotFoundException e )
+                {
+                    throw new LifecycleExecutionException( e.getMessage(), e );
+                }
             }
 
-            Map handlers = findArtifactTypeHandlers( project, session.getSettings(), session.getLocalRepository() );
-            artifactHandlerManager.addHandlers( handlers );
+            try
+            {
+                Map handlers = findArtifactTypeHandlers( project, session.getSettings(), session.getLocalRepository() );
+                artifactHandlerManager.addHandlers( handlers );
+            }
+            catch ( PluginNotFoundException e )
+            {
+                throw new LifecycleExecutionException( e.getMessage(), e );
+            }
         }
     }
 
     private void executeTaskSegments( List taskSegments, ReactorManager rm, MavenSession session,
-                                      MavenProject rootProject, EventDispatcher dispatcher,
-                                      MavenExecutionResponse response )
-        throws ArtifactNotFoundException, MojoExecutionException, LifecycleExecutionException, MojoFailureException,
-        ArtifactResolutionException, PluginNotFoundException
+                                      MavenProject rootProject, EventDispatcher dispatcher )
+        throws LifecycleExecutionException, BuildFailureException
     {
         for ( Iterator it = taskSegments.iterator(); it.hasNext(); )
         {
@@ -238,27 +206,18 @@
                     String target = rootProject.getId() + " ( " + segment + " )";
                     dispatcher.dispatchStart( event, target );
 
-                    try
+                    // only call once, with the top-level project (assumed to be provided as a parameter)...
+                    for ( Iterator goalIterator = segment.getTasks().iterator(); goalIterator.hasNext(); )
                     {
-                        // only call once, with the top-level project (assumed to be provided as a parameter)...
-                        for ( Iterator goalIterator = segment.getTasks().iterator(); goalIterator.hasNext(); )
-                        {
-                            String task = (String) goalIterator.next();
+                        String task = (String) goalIterator.next();
 
-                            executeGoalAndHandleFailures( task, session, rootProject, response, dispatcher, event, rm,
-                                                          buildStartTime, target );
-                        }
-
-                        rm.registerBuildSuccess( rootProject, System.currentTimeMillis() - buildStartTime );
-
-                        dispatcher.dispatchEnd( event, target );
+                        executeGoalAndHandleFailures( task, session, rootProject, dispatcher, event, rm, buildStartTime,
+                                                      target );
                     }
-                    catch ( LifecycleExecutionException e )
-                    {
-                        dispatcher.dispatchError( event, target, e );
 
-                        throw e;
-                    }
+                    rm.registerBuildSuccess( rootProject, System.currentTimeMillis() - buildStartTime );
+
+                    dispatcher.dispatchEnd( event, target );
                 }
                 else
                 {
@@ -278,8 +237,6 @@
             {
                 List sortedProjects = session.getSortedProjects();
 
-                response.setExecutedMultipleProjects( true );
-
                 // iterate over projects, and execute on each...
                 for ( Iterator projectIterator = sortedProjects.iterator(); projectIterator.hasNext(); )
                 {
@@ -304,26 +261,17 @@
                         String target = currentProject.getId() + " ( " + segment + " )";
                         dispatcher.dispatchStart( event, target );
 
-                        try
+                        for ( Iterator goalIterator = segment.getTasks().iterator(); goalIterator.hasNext(); )
                         {
-                            for ( Iterator goalIterator = segment.getTasks().iterator(); goalIterator.hasNext(); )
-                            {
-                                String task = (String) goalIterator.next();
-
-                                executeGoalAndHandleFailures( task, session, currentProject, response, dispatcher,
-                                                              event, rm, buildStartTime, target );
-                            }
-
-                            rm.registerBuildSuccess( currentProject, System.currentTimeMillis() - buildStartTime );
+                            String task = (String) goalIterator.next();
 
-                            dispatcher.dispatchEnd( event, target );
+                            executeGoalAndHandleFailures( task, session, currentProject, dispatcher, event, rm,
+                                                          buildStartTime, target );
                         }
-                        catch ( LifecycleExecutionException e )
-                        {
-                            dispatcher.dispatchError( event, target, e );
 
-                            throw e;
-                        }
+                        rm.registerBuildSuccess( currentProject, System.currentTimeMillis() - buildStartTime );
+
+                        dispatcher.dispatchEnd( event, target );
                     }
                     else
                     {
@@ -344,93 +292,52 @@
     }
 
     private void executeGoalAndHandleFailures( String task, MavenSession session, MavenProject project,
-                                               MavenExecutionResponse response, EventDispatcher dispatcher,
-                                               String event, ReactorManager rm, long buildStartTime, String target )
-        throws LifecycleExecutionException, MojoExecutionException, MojoFailureException, ArtifactNotFoundException,
-        ArtifactResolutionException, PluginNotFoundException
+                                               EventDispatcher dispatcher, String event, ReactorManager rm,
+                                               long buildStartTime, String target )
+        throws BuildFailureException, LifecycleExecutionException
     {
         try
         {
-            executeGoal( task, session, project, response );
-        }
-        catch ( MojoExecutionException e )
-        {
-            dispatcher.dispatchError( event, target, e );
-
-            handleExecutionFailure( rm, project, e, task, buildStartTime );
-        }
-        catch ( ArtifactResolutionException e )
-        {
-            dispatcher.dispatchError( event, target, e );
-
-            handleExecutionFailure( rm, project, e, task, buildStartTime );
-        }
-        catch ( MojoFailureException e )
-        {
-            // TODO: should be dispatchFailure?
-            dispatcher.dispatchError( event, target, e );
-
-            handleExecutionFailure( rm, project, e, task, buildStartTime );
+            executeGoal( task, session, project );
         }
-        catch ( ArtifactNotFoundException e )
+        catch ( LifecycleExecutionException e )
         {
-            // TODO: should be dispatchFailure?
             dispatcher.dispatchError( event, target, e );
 
-            handleExecutionFailure( rm, project, e, task, buildStartTime );
+            if ( handleExecutionFailure( rm, project, e, task, buildStartTime ) )
+            {
+                throw e;
+            }
         }
-        catch ( InvalidDependencyVersionException e )
+        catch ( BuildFailureException e )
         {
-            // TODO: should be dispatchFailure?
             dispatcher.dispatchError( event, target, e );
 
-            handleExecutionFailure( rm, project, e, task, buildStartTime );
+            if ( handleExecutionFailure( rm, project, e, task, buildStartTime ) )
+            {
+                throw e;
+            }
         }
     }
 
-    private void handleExecutionFailure( ReactorManager rm, MavenProject project, Exception e, String task,
-                                         long buildStartTime )
-        throws MojoExecutionException, MojoFailureException, ArtifactNotFoundException, ArtifactResolutionException
+    private boolean handleExecutionFailure( ReactorManager rm, MavenProject project, Exception e, String task,
+                                            long buildStartTime )
     {
+        rm.registerBuildFailure( project, e, task, System.currentTimeMillis() - buildStartTime );
+
         if ( ReactorManager.FAIL_FAST.equals( rm.getFailureBehavior() ) )
         {
-            rm.registerBuildFailure( project, e, task, System.currentTimeMillis() - buildStartTime );
-
-            if ( e instanceof MojoExecutionException )
-            {
-                throw (MojoExecutionException) e;
-            }
-            if ( e instanceof MojoFailureException )
-            {
-                throw (MojoFailureException) e;
-            }
-            else if ( e instanceof ArtifactNotFoundException )
-            {
-                throw (ArtifactNotFoundException) e;
-            }
-            else if ( e instanceof ArtifactResolutionException )
-            {
-                throw (ArtifactResolutionException) e;
-            }
-            else
-            {
-                getLogger().error( "Attempt to register inappropriate build-failure Exception.", e );
-
-                throw new IllegalArgumentException( "Inappropriate build-failure Exception: " + e );
-            }
+            return true;
         }
         else if ( ReactorManager.FAIL_AT_END.equals( rm.getFailureBehavior() ) )
         {
-            rm.registerBuildFailure( project, e, task, System.currentTimeMillis() - buildStartTime );
-
             rm.blackList( project );
         }
-        // FIXME: how about the other cases?
+        return false;
     }
 
     private List segmentTaskListByAggregationNeeds( List tasks, MavenSession session, MavenProject project )
-        throws LifecycleExecutionException, ArtifactNotFoundException, PluginNotFoundException,
-        ArtifactResolutionException
+        throws LifecycleExecutionException, BuildFailureException
     {
         List segments = new ArrayList();
 
@@ -526,34 +433,39 @@
         return segments;
     }
 
-    private void executeGoal( String task, MavenSession session, MavenProject project, MavenExecutionResponse response )
-        throws LifecycleExecutionException, ArtifactNotFoundException, MojoExecutionException,
-        ArtifactResolutionException, MojoFailureException, InvalidDependencyVersionException, PluginNotFoundException
+    private void executeGoal( String task, MavenSession session, MavenProject project )
+        throws LifecycleExecutionException, BuildFailureException
     {
-        if ( getPhaseToLifecycleMap().containsKey( task ) )
+        try
         {
-            Lifecycle lifecycle = getLifecycleForPhase( task );
+            if ( getPhaseToLifecycleMap().containsKey( task ) )
+            {
+                Lifecycle lifecycle = getLifecycleForPhase( task );
 
-            // we have a lifecycle phase, so lets bind all the necessary goals
-            Map lifecycleMappings = constructLifecycleMappings( session, task, project, lifecycle );
-            executeGoalWithLifecycle( task, session, lifecycleMappings, project, response, lifecycle );
+                // we have a lifecycle phase, so lets bind all the necessary goals
+                Map lifecycleMappings = constructLifecycleMappings( session, task, project, lifecycle );
+                executeGoalWithLifecycle( task, session, lifecycleMappings, project, lifecycle );
+            }
+            else
+            {
+                executeStandaloneGoal( task, session, project );
+            }
         }
-        else
+        catch ( PluginNotFoundException e )
         {
-            executeStandaloneGoal( task, session, project, response );
+            throw new BuildFailureException( "A required plugin was not found", e.getMessage(), e );
         }
     }
 
     private void executeGoalWithLifecycle( String task, MavenSession session, Map lifecycleMappings,
-                                           MavenProject project, MavenExecutionResponse response, Lifecycle lifecycle )
-        throws ArtifactResolutionException, LifecycleExecutionException, MojoExecutionException, MojoFailureException,
-        ArtifactNotFoundException, InvalidDependencyVersionException, PluginNotFoundException
+                                           MavenProject project, Lifecycle lifecycle )
+        throws LifecycleExecutionException, BuildFailureException, PluginNotFoundException
     {
         List goals = processGoalChain( task, lifecycleMappings, lifecycle );
 
         if ( !goals.isEmpty() )
         {
-            executeGoals( goals, session, project, response );
+            executeGoals( goals, session, project );
         }
         else
         {
@@ -561,19 +473,16 @@
         }
     }
 
-    private void executeStandaloneGoal( String task, MavenSession session, MavenProject project,
-                                        MavenExecutionResponse response )
-        throws ArtifactResolutionException, LifecycleExecutionException, MojoExecutionException, MojoFailureException,
-        ArtifactNotFoundException, InvalidDependencyVersionException, PluginNotFoundException
+    private void executeStandaloneGoal( String task, MavenSession session, MavenProject project )
+        throws LifecycleExecutionException, BuildFailureException, PluginNotFoundException
     {
         // guaranteed to come from the CLI and not be part of a phase
         MojoDescriptor mojoDescriptor = getMojoDescriptor( task, session, project, task, true );
-        executeGoals( Collections.singletonList( new MojoExecution( mojoDescriptor ) ), session, project, response );
+        executeGoals( Collections.singletonList( new MojoExecution( mojoDescriptor ) ), session, project );
     }
 
-    private void executeGoals( List goals, MavenSession session, MavenProject project, MavenExecutionResponse response )
-        throws LifecycleExecutionException, MojoExecutionException, ArtifactResolutionException, MojoFailureException,
-        ArtifactNotFoundException, InvalidDependencyVersionException, PluginNotFoundException
+    private void executeGoals( List goals, MavenSession session, MavenProject project )
+        throws LifecycleExecutionException, BuildFailureException, PluginNotFoundException
     {
         for ( Iterator i = goals.iterator(); i.hasNext(); )
         {
@@ -583,7 +492,7 @@
 
             if ( mojoDescriptor.getExecutePhase() != null || mojoDescriptor.getExecuteGoal() != null )
             {
-                forkLifecycle( mojoDescriptor, session, project, response );
+                forkLifecycle( mojoDescriptor, session, project );
             }
 
             if ( mojoDescriptor.isRequiresReports() )
@@ -599,7 +508,7 @@
 
                     if ( descriptor.getExecutePhase() != null )
                     {
-                        forkLifecycle( descriptor, session, project, response );
+                        forkLifecycle( descriptor, session, project );
                     }
                 }
             }
@@ -613,12 +522,35 @@
                 throw new LifecycleExecutionException( "Internal error in the plugin manager executing goal '" +
                     mojoDescriptor.getId() + "': " + e.getMessage(), e );
             }
+            catch ( ArtifactNotFoundException e )
+            {
+                throw new LifecycleExecutionException( e.getMessage(), e );
+            }
+            catch ( InvalidDependencyVersionException e )
+            {
+                throw new LifecycleExecutionException( e.getMessage(), e );
+            }
+            catch ( ArtifactResolutionException e )
+            {
+                throw new LifecycleExecutionException( e.getMessage(), e );
+            }
+            catch ( MojoFailureException e )
+            {
+                throw new BuildFailureException( e.getMessage(), e.getLongMessage(), e );
+            }
+            catch ( MojoExecutionException e )
+            {
+                throw new LifecycleExecutionException( e.getMessage(), e );
+            }
+            catch ( PluginConfigurationException e )
+            {
+                throw new LifecycleExecutionException( e.getMessage(), e );
+            }
         }
     }
 
     private List getReports( MavenProject project, MojoExecution mojoExecution, MavenSession session )
-        throws ArtifactResolutionException, LifecycleExecutionException, ArtifactNotFoundException,
-        PluginNotFoundException
+        throws LifecycleExecutionException, PluginNotFoundException
     {
         List reportPlugins = project.getReportPlugins();
 
@@ -704,8 +636,7 @@
 
     private List getReports( ReportPlugin reportPlugin, ReportSet reportSet, MavenProject project, MavenSession session,
                              MojoExecution mojoExecution )
-        throws ArtifactResolutionException, ArtifactNotFoundException, LifecycleExecutionException,
-        PluginNotFoundException
+        throws LifecycleExecutionException, PluginNotFoundException
     {
         PluginDescriptor pluginDescriptor = verifyReportPlugin( reportPlugin, project, session );
 
@@ -747,23 +678,27 @@
                     throw new LifecycleExecutionException(
                         "Error getting reports from the plugin '" + reportPlugin.getKey() + "'", e );
                 }
+                catch ( ArtifactNotFoundException e )
+                {
+                    throw new LifecycleExecutionException( e.getMessage(), e );
+                }
+                catch ( ArtifactResolutionException e )
+                {
+                    throw new LifecycleExecutionException( e.getMessage(), e );
+                }
             }
         }
         return reports;
     }
 
-    private void forkLifecycle( MojoDescriptor mojoDescriptor, MavenSession session, MavenProject project,
-                                MavenExecutionResponse response )
-        throws LifecycleExecutionException, MojoExecutionException, ArtifactResolutionException, MojoFailureException,
-        ArtifactNotFoundException, InvalidDependencyVersionException, PluginNotFoundException
+    private void forkLifecycle( MojoDescriptor mojoDescriptor, MavenSession session, MavenProject project )
+        throws LifecycleExecutionException, BuildFailureException, PluginNotFoundException
     {
         PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
         getLogger().info( "Preparing " + pluginDescriptor.getGoalPrefix() + ":" + mojoDescriptor.getGoal() );
 
         if ( mojoDescriptor.isAggregator() )
         {
-            response.setExecutedMultipleProjects( true );
-
             for ( Iterator i = session.getSortedProjects().iterator(); i.hasNext(); )
             {
                 MavenProject reactorProject = (MavenProject) i.next();
@@ -774,19 +709,17 @@
 
                 line();
 
-                forkProjectLifecycle( mojoDescriptor, session, reactorProject, response );
+                forkProjectLifecycle( mojoDescriptor, session, reactorProject );
             }
         }
         else
         {
-            forkProjectLifecycle( mojoDescriptor, session, project, response );
+            forkProjectLifecycle( mojoDescriptor, session, project );
         }
     }
 
-    private void forkProjectLifecycle( MojoDescriptor mojoDescriptor, MavenSession session, MavenProject project,
-                                       MavenExecutionResponse response )
-        throws ArtifactResolutionException, LifecycleExecutionException, MojoExecutionException, MojoFailureException,
-        ArtifactNotFoundException, InvalidDependencyVersionException, PluginNotFoundException
+    private void forkProjectLifecycle( MojoDescriptor mojoDescriptor, MavenSession session, MavenProject project )
+        throws LifecycleExecutionException, BuildFailureException, PluginNotFoundException
     {
         PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
 
@@ -852,25 +785,25 @@
         {
             Lifecycle lifecycle = getLifecycleForPhase( targetPhase );
 
-            executeGoalWithLifecycle( targetPhase, session, lifecycleMappings, executionProject, response, lifecycle );
+            executeGoalWithLifecycle( targetPhase, session, lifecycleMappings, executionProject, lifecycle );
         }
         else
         {
             String goal = mojoDescriptor.getExecuteGoal();
             MojoDescriptor desc = getMojoDescriptor( pluginDescriptor, goal );
-            executeGoals( Collections.singletonList( new MojoExecution( desc ) ), session, executionProject, response );
+            executeGoals( Collections.singletonList( new MojoExecution( desc ) ), session, executionProject );
         }
         project.setExecutionProject( executionProject );
     }
 
     private Lifecycle getLifecycleForPhase( String phase )
-        throws LifecycleExecutionException
+        throws BuildFailureException, LifecycleExecutionException
     {
         Lifecycle lifecycle = (Lifecycle) getPhaseToLifecycleMap().get( phase );
 
         if ( lifecycle == null )
         {
-            throw new LifecycleExecutionException( "Unable to find lifecycle for phase '" + phase + "'" );
+            throw new BuildFailureException( "Unable to find lifecycle for phase '" + phase + "'" );
         }
         return lifecycle;
     }
@@ -922,8 +855,7 @@
 
     private Map constructLifecycleMappings( MavenSession session, String selectedPhase, MavenProject project,
                                             Lifecycle lifecycle )
-        throws ArtifactResolutionException, LifecycleExecutionException, ArtifactNotFoundException,
-        PluginNotFoundException
+        throws LifecycleExecutionException, BuildFailureException, PluginNotFoundException
     {
         // first, bind those associated with the packaging
         Map lifecycleMappings = bindLifecycleForPackaging( session, selectedPhase, project, lifecycle );
@@ -941,8 +873,7 @@
 
     private Map bindLifecycleForPackaging( MavenSession session, String selectedPhase, MavenProject project,
                                            Lifecycle lifecycle )
-        throws ArtifactResolutionException, LifecycleExecutionException, ArtifactNotFoundException,
-        PluginNotFoundException
+        throws LifecycleExecutionException, BuildFailureException, PluginNotFoundException
     {
         Map mappings = findMappingsForLifecycle( session, project, lifecycle );
 
@@ -985,8 +916,7 @@
     }
 
     private Map findMappingsForLifecycle( MavenSession session, MavenProject project, Lifecycle lifecycle )
-        throws ArtifactResolutionException, LifecycleExecutionException, ArtifactNotFoundException,
-        PluginNotFoundException
+        throws LifecycleExecutionException, PluginNotFoundException
     {
         String packaging = project.getPackaging();
         Map mappings = null;
@@ -1035,8 +965,7 @@
 
     private Object findExtension( MavenProject project, String role, String roleHint, Settings settings,
                                   ArtifactRepository localRepository )
-        throws ArtifactResolutionException, ArtifactNotFoundException, LifecycleExecutionException,
-        PluginNotFoundException
+        throws LifecycleExecutionException, PluginNotFoundException
     {
         Object pluginComponent = null;
 
@@ -1072,8 +1001,7 @@
      * lookup directly, or have them passed in
      */
     private Map findArtifactTypeHandlers( MavenProject project, Settings settings, ArtifactRepository localRepository )
-        throws ArtifactResolutionException, ArtifactNotFoundException, LifecycleExecutionException,
-        PluginNotFoundException
+        throws LifecycleExecutionException, PluginNotFoundException
     {
         Map map = new HashMap();
         for ( Iterator i = project.getBuildPlugins().iterator(); i.hasNext(); )
@@ -1123,8 +1051,7 @@
      * @param session
      */
     private void bindPluginToLifecycle( Plugin plugin, MavenSession session, Map phaseMap, MavenProject project )
-        throws LifecycleExecutionException, ArtifactResolutionException, ArtifactNotFoundException,
-        PluginNotFoundException
+        throws LifecycleExecutionException, PluginNotFoundException
     {
         PluginDescriptor pluginDescriptor;
         Settings settings = session.getSettings();
@@ -1159,8 +1086,7 @@
 
     private PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, Settings settings,
                                            ArtifactRepository localRepository )
-        throws ArtifactResolutionException, LifecycleExecutionException, ArtifactNotFoundException,
-        PluginNotFoundException
+        throws LifecycleExecutionException, PluginNotFoundException
     {
         PluginDescriptor pluginDescriptor;
         try
@@ -1174,22 +1100,33 @@
         }
         catch ( PluginVersionResolutionException e )
         {
-            throw new LifecycleExecutionException( "Error resolving plugin version", e );
+            throw new LifecycleExecutionException( "Error resolving plugin version: " + e.getMessage(), e );
         }
         catch ( InvalidVersionSpecificationException e )
         {
-            throw new LifecycleExecutionException( "Error resolving plugin version", e );
+            throw new LifecycleExecutionException( e.getMessage(), e );
         }
         catch ( InvalidPluginException e )
         {
-            throw new LifecycleExecutionException( "Error resolving plugin version", e );
+            throw new LifecycleExecutionException( e.getMessage(), e );
+        }
+        catch ( ArtifactNotFoundException e )
+        {
+            throw new LifecycleExecutionException( e.getMessage(), e );
+        }
+        catch ( ArtifactResolutionException e )
+        {
+            throw new LifecycleExecutionException( e.getMessage(), e );
+        }
+        catch ( PluginVersionNotFoundException e )
+        {
+            throw new LifecycleExecutionException( e.getMessage(), e );
         }
         return pluginDescriptor;
     }
 
     private PluginDescriptor verifyReportPlugin( ReportPlugin plugin, MavenProject project, MavenSession session )
-        throws ArtifactResolutionException, LifecycleExecutionException, ArtifactNotFoundException,
-        PluginNotFoundException
+        throws LifecycleExecutionException, PluginNotFoundException
     {
         PluginDescriptor pluginDescriptor;
         try
@@ -1203,15 +1140,27 @@
         }
         catch ( PluginVersionResolutionException e )
         {
-            throw new LifecycleExecutionException( "Error resolving plugin version", e );
+            throw new LifecycleExecutionException( "Error resolving plugin version: " + e.getMessage(), e );
         }
         catch ( InvalidVersionSpecificationException e )
         {
-            throw new LifecycleExecutionException( "Error resolving plugin version", e );
+            throw new LifecycleExecutionException( e.getMessage(), e );
         }
         catch ( InvalidPluginException e )
         {
-            throw new LifecycleExecutionException( "Error resolving plugin version", e );
+            throw new LifecycleExecutionException( e.getMessage(), e );
+        }
+        catch ( ArtifactNotFoundException e )
+        {
+            throw new LifecycleExecutionException( e.getMessage(), e );
+        }
+        catch ( ArtifactResolutionException e )
+        {
+            throw new LifecycleExecutionException( e.getMessage(), e );
+        }
+        catch ( PluginVersionNotFoundException e )
+        {
+            throw new LifecycleExecutionException( e.getMessage(), e );
         }
         return pluginDescriptor;
     }
@@ -1227,7 +1176,8 @@
             MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( goal );
             if ( mojoDescriptor == null )
             {
-                throw new LifecycleExecutionException( "Goal from the POM '" + goal + "' was not found in the plugin" );
+                throw new LifecycleExecutionException(
+                    "'" + goal + "' was specified in an execution, but not found in the plugin" );
             }
 
             // We have to check to see that the inheritance rules have been applied before binding this mojo.
@@ -1303,8 +1253,7 @@
 
     private MojoDescriptor getMojoDescriptor( String task, MavenSession session, MavenProject project,
                                               String invokedVia, boolean canUsePrefix )
-        throws LifecycleExecutionException, ArtifactNotFoundException, PluginNotFoundException,
-        ArtifactResolutionException
+        throws BuildFailureException, LifecycleExecutionException, PluginNotFoundException
     {
         String goal;
         Plugin plugin;
@@ -1398,7 +1347,7 @@
         {
             String message = "Invalid task '" + task + "': you must specify a valid lifecycle phase, or" +
                 " a goal in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal";
-            throw new LifecycleExecutionException( message );
+            throw new BuildFailureException( message );
         }
 
         if ( pluginDescriptor == null )
@@ -1413,7 +1362,7 @@
         MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( goal );
         if ( mojoDescriptor == null )
         {
-            throw new LifecycleExecutionException( "Required goal not found: " + task );
+            throw new BuildFailureException( "Required goal not found: " + task );
         }
 
         return mojoDescriptor;

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java?rev=320797&r1=320796&r2=320797&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java Thu Oct 13 09:36:54 2005
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 
-import org.apache.maven.execution.MavenExecutionResponse;
+import org.apache.maven.BuildFailureException;
 import org.apache.maven.execution.MavenSession;
 import org.apache.maven.execution.ReactorManager;
 import org.apache.maven.monitor.event.EventDispatcher;
@@ -29,7 +29,7 @@
 {
     String ROLE = LifecycleExecutor.class.getName();
 
-    MavenExecutionResponse execute( MavenSession session, ReactorManager rpm, EventDispatcher dispatcher )
-        throws LifecycleExecutionException;
+    void execute( MavenSession session, ReactorManager rpm, EventDispatcher dispatcher )
+        throws LifecycleExecutionException, BuildFailureException;
 
 }

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=320797&r1=320796&r2=320797&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 Thu Oct 13 09:36:54 2005
@@ -45,6 +45,7 @@
 import org.apache.maven.plugin.descriptor.PluginDescriptorBuilder;
 import org.apache.maven.plugin.logging.Log;
 import org.apache.maven.plugin.version.PluginVersionManager;
+import org.apache.maven.plugin.version.PluginVersionNotFoundException;
 import org.apache.maven.plugin.version.PluginVersionResolutionException;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectBuilder;
@@ -147,7 +148,8 @@
     public PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, Settings settings,
                                           ArtifactRepository localRepository )
         throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException,
-        InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException
+        InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException,
+        PluginVersionNotFoundException
     {
         // TODO: this should be possibly outside
         // All version-resolution logic has been moved to DefaultPluginVersionManager.
@@ -238,7 +240,7 @@
      * manager which executes before the plugin is instantiated
      */
     private void checkRequiredMavenVersion( Plugin plugin, ArtifactRepository localRepository, List remoteRepositories )
-        throws PluginVersionResolutionException
+        throws PluginVersionResolutionException, InvalidPluginException
     {
         try
         {
@@ -260,8 +262,8 @@
         }
         catch ( ProjectBuildingException e )
         {
-            throw new PluginVersionResolutionException( plugin.getGroupId(), plugin.getArtifactId(),
-                                                        "Unable to build project for plugin", e );
+            throw new InvalidPluginException(
+                "Unable to build project for plugin '" + plugin.getKey() + "': " + e.getMessage(), e );
         }
     }
 
@@ -313,7 +315,7 @@
 
     public void executeMojo( MavenProject project, MojoExecution mojoExecution, MavenSession session )
         throws ArtifactResolutionException, MojoExecutionException, MojoFailureException, ArtifactNotFoundException,
-        InvalidDependencyVersionException, PluginManagerException
+        InvalidDependencyVersionException, PluginManagerException, PluginConfigurationException
     {
         MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
 
@@ -359,29 +361,21 @@
 
         Mojo plugin;
 
-        try
-        {
-            PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
-            String goalId = mojoDescriptor.getGoal();
-            String groupId = pluginDescriptor.getGroupId();
-            String artifactId = pluginDescriptor.getArtifactId();
-            String executionId = mojoExecution.getExecutionId();
-            Xpp3Dom dom = project.getGoalConfiguration( groupId, artifactId, executionId, goalId );
-            Xpp3Dom reportDom = project.getReportConfiguration( groupId, artifactId, executionId );
-            dom = Xpp3Dom.mergeXpp3Dom( dom, reportDom );
-            if ( mojoExecution.getConfiguration() != null )
-            {
-                dom = Xpp3Dom.mergeXpp3Dom( dom, mojoExecution.getConfiguration() );
-            }
-
-            plugin = getConfiguredMojo( session, dom, project, false, mojoExecution );
-        }
-        catch ( PluginConfigurationException e )
+        PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
+        String goalId = mojoDescriptor.getGoal();
+        String groupId = pluginDescriptor.getGroupId();
+        String artifactId = pluginDescriptor.getArtifactId();
+        String executionId = mojoExecution.getExecutionId();
+        Xpp3Dom dom = project.getGoalConfiguration( groupId, artifactId, executionId, goalId );
+        Xpp3Dom reportDom = project.getReportConfiguration( groupId, artifactId, executionId );
+        dom = Xpp3Dom.mergeXpp3Dom( dom, reportDom );
+        if ( mojoExecution.getConfiguration() != null )
         {
-            String msg = "Error configuring plugin for execution of '" + goalName + "'.";
-            throw new MojoExecutionException( msg, e );
+            dom = Xpp3Dom.mergeXpp3Dom( dom, mojoExecution.getConfiguration() );
         }
 
+        plugin = getConfiguredMojo( session, dom, project, false, mojoExecution );
+
         // Event monitoring.
         String event = MavenEvents.MOJO_EXECUTION;
         EventDispatcher dispatcher = session.getEventDispatcher();
@@ -457,7 +451,8 @@
 
     public PluginDescriptor verifyReportPlugin( ReportPlugin reportPlugin, MavenProject project, MavenSession session )
         throws PluginVersionResolutionException, ArtifactResolutionException, ArtifactNotFoundException,
-        InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException
+        InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException,
+        PluginVersionNotFoundException
     {
         String version = reportPlugin.getVersion();
 

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java?rev=320797&r1=320796&r2=320797&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginManager.java Thu Oct 13 09:36:54 2005
@@ -24,6 +24,7 @@
 import org.apache.maven.model.Plugin;
 import org.apache.maven.model.ReportPlugin;
 import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.plugin.version.PluginVersionNotFoundException;
 import org.apache.maven.plugin.version.PluginVersionResolutionException;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.artifact.InvalidDependencyVersionException;
@@ -43,7 +44,7 @@
 
     void executeMojo( MavenProject project, MojoExecution execution, MavenSession session )
         throws MojoExecutionException, ArtifactResolutionException, MojoFailureException, ArtifactNotFoundException,
-        InvalidDependencyVersionException, PluginManagerException;
+        InvalidDependencyVersionException, PluginManagerException, PluginConfigurationException;
 
     MavenReport getReport( MavenProject project, MojoExecution mojoExecution, MavenSession session )
         throws ArtifactNotFoundException, PluginConfigurationException, PluginManagerException,
@@ -56,11 +57,13 @@
     PluginDescriptor verifyPlugin( Plugin plugin, MavenProject project, Settings settings,
                                    ArtifactRepository localRepository )
         throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException,
-        InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException;
+        InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException,
+        PluginVersionNotFoundException;
 
     PluginDescriptor verifyReportPlugin( ReportPlugin reportPlugin, MavenProject project, MavenSession session )
         throws PluginVersionResolutionException, ArtifactResolutionException, ArtifactNotFoundException,
-        InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException;
+        InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException,
+        PluginVersionNotFoundException;
 
     Object getPluginComponent( Plugin plugin, String role, String roleHint )
         throws PluginManagerException, ComponentLookupException;

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java?rev=320797&r1=320796&r2=320797&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/DefaultPluginVersionManager.java Thu Oct 13 09:36:54 2005
@@ -27,6 +27,7 @@
 import org.apache.maven.execution.RuntimeInformation;
 import org.apache.maven.model.Plugin;
 import org.apache.maven.model.ReportPlugin;
+import org.apache.maven.plugin.InvalidPluginException;
 import org.apache.maven.plugin.registry.MavenPluginRegistryBuilder;
 import org.apache.maven.plugin.registry.PluginRegistry;
 import org.apache.maven.plugin.registry.PluginRegistryUtils;
@@ -74,21 +75,21 @@
 
     public String resolvePluginVersion( String groupId, String artifactId, MavenProject project, Settings settings,
                                         ArtifactRepository localRepository )
-        throws PluginVersionResolutionException
+        throws PluginVersionResolutionException, InvalidPluginException, PluginVersionNotFoundException
     {
         return resolvePluginVersion( groupId, artifactId, project, settings, localRepository, false );
     }
 
     public String resolveReportPluginVersion( String groupId, String artifactId, MavenProject project,
                                               Settings settings, ArtifactRepository localRepository )
-        throws PluginVersionResolutionException
+        throws PluginVersionResolutionException, InvalidPluginException, PluginVersionNotFoundException
     {
         return resolvePluginVersion( groupId, artifactId, project, settings, localRepository, true );
     }
 
     private String resolvePluginVersion( String groupId, String artifactId, MavenProject project, Settings settings,
                                          ArtifactRepository localRepository, boolean resolveAsReportPlugin )
-        throws PluginVersionResolutionException
+        throws PluginVersionResolutionException, InvalidPluginException, PluginVersionNotFoundException
     {
         // first pass...if the plugin is specified in the pom, try to retrieve the version from there.
         String version = getVersionFromPluginConfig( groupId, artifactId, project, resolveAsReportPlugin );
@@ -214,8 +215,8 @@
         // if we still haven't found a version, then fail early before we get into the update goop.
         if ( StringUtils.isEmpty( version ) )
         {
-            throw new PluginVersionResolutionException( groupId, artifactId,
-                                                        "Failed to resolve a valid version for this plugin" );
+            throw new PluginVersionNotFoundException( groupId, artifactId,
+                                                      "Failed to resolve a valid version for this plugin" );
         }
 
         // if the plugin registry is inactive, then the rest of this goop is useless...
@@ -625,7 +626,7 @@
             catch ( IOException e )
             {
                 throw new PluginVersionResolutionException( groupId, artifactId,
-                                                            "Error readin plugin registry: " + e.getMessage(), e );
+                                                            "Error reading plugin registry: " + e.getMessage(), e );
             }
             catch ( XmlPullParserException e )
             {
@@ -644,7 +645,7 @@
 
     private String resolveMetaVersion( String groupId, String artifactId, MavenProject project,
                                        ArtifactRepository localRepository, String metaVersionId )
-        throws PluginVersionResolutionException
+        throws PluginVersionResolutionException, InvalidPluginException
     {
         Artifact artifact = artifactFactory.createProjectArtifact( groupId, artifactId, metaVersionId );
 
@@ -677,8 +678,8 @@
             }
             catch ( ProjectBuildingException e )
             {
-                throw new PluginVersionResolutionException( groupId, artifactId,
-                                                            "Unable to build resolve plugin project information", e );
+                throw new InvalidPluginException( "Unable to build project information for plugin '" +
+                    ArtifactUtils.versionlessKey( groupId, artifactId ) + "': " + e.getMessage(), e );
             }
 
             boolean pluginValid = true;

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionManager.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionManager.java?rev=320797&r1=320796&r2=320797&view=diff
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionManager.java (original)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionManager.java Thu Oct 13 09:36:54 2005
@@ -17,6 +17,7 @@
  */
 
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.plugin.InvalidPluginException;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.settings.Settings;
 
@@ -26,10 +27,10 @@
 
     String resolvePluginVersion( String groupId, String artifactId, MavenProject project, Settings settings,
                                  ArtifactRepository localRepository )
-        throws PluginVersionResolutionException;
+        throws PluginVersionResolutionException, InvalidPluginException, PluginVersionNotFoundException;
 
     String resolveReportPluginVersion( String groupId, String artifactId, MavenProject project, Settings settings,
                                        ArtifactRepository localRepository )
-        throws PluginVersionResolutionException;
+        throws PluginVersionResolutionException, InvalidPluginException, PluginVersionNotFoundException;
 
 }

Added: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java?rev=320797&view=auto
==============================================================================
--- maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java (added)
+++ maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java Thu Oct 13 09:36:54 2005
@@ -0,0 +1,44 @@
+package org.apache.maven.plugin.version;
+
+/*
+ * Copyright 2001-2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+public class PluginVersionNotFoundException
+    extends Exception
+{
+    private final String groupId;
+
+    private final String artifactId;
+
+    public PluginVersionNotFoundException( String groupId, String artifactId, String baseMessage )
+    {
+        super( "Error resolving version for \'" + groupId + ":" + artifactId + "\': " + baseMessage );
+
+        this.groupId = groupId;
+        this.artifactId = artifactId;
+    }
+
+    public String getGroupId()
+    {
+        return groupId;
+    }
+
+    public String getArtifactId()
+    {
+        return artifactId;
+    }
+
+}

Propchange: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/components/trunk/maven-core/src/main/java/org/apache/maven/plugin/version/PluginVersionNotFoundException.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/components/trunk/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java?rev=320797&r1=320796&r2=320797&view=diff
==============================================================================
--- maven/components/trunk/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java (original)
+++ maven/components/trunk/maven-plugins/maven-projecthelp-plugin/src/main/java/org/apache/maven/plugins/projecthelp/DescribeMojo.java Thu Oct 13 09:36:54 2005
@@ -32,6 +32,7 @@
 import org.apache.maven.plugin.descriptor.MojoDescriptor;
 import org.apache.maven.plugin.descriptor.Parameter;
 import org.apache.maven.plugin.descriptor.PluginDescriptor;
+import org.apache.maven.plugin.version.PluginVersionNotFoundException;
 import org.apache.maven.plugin.version.PluginVersionResolutionException;
 import org.apache.maven.project.MavenProject;
 import org.apache.maven.project.MavenProjectBuilder;
@@ -336,7 +337,13 @@
             }
             catch ( PluginNotFoundException e )
             {
-                throw new MojoExecutionException( "Plugin does not exist: " + e.getMessage(), e );
+                getLog().debug( "Unable to find plugin", e );
+                throw new MojoFailureException( "Plugin does not exist: " + e.getMessage() );
+            }
+            catch ( PluginVersionNotFoundException e )
+            {
+                getLog().debug( "Unable to find plugin version", e );
+                throw new MojoFailureException( e.getMessage() );
             }
         }