You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by jv...@apache.org on 2007/09/03 03:39:28 UTC

svn commit: r572210 - in /maven/components/trunk: maven-core/src/main/java/org/apache/maven/DefaultMaven.java maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java

Author: jvanzyl
Date: Sun Sep  2 18:39:28 2007
New Revision: 572210

URL: http://svn.apache.org/viewvc?rev=572210&view=rev
Log:
MNG-2398: the lifecycle executor exception wasn't being propagated properly.

Modified:
    maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
    maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java

Modified: maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java?rev=572210&r1=572209&r2=572210&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 Sun Sep  2 18:39:28 2007
@@ -37,6 +37,7 @@
 import org.apache.maven.extension.BuildExtensionScanner;
 import org.apache.maven.extension.ExtensionScanningException;
 import org.apache.maven.lifecycle.LifecycleExecutor;
+import org.apache.maven.lifecycle.LifecycleUtils;
 import org.apache.maven.monitor.event.DefaultEventDispatcher;
 import org.apache.maven.monitor.event.EventDispatcher;
 import org.apache.maven.monitor.event.MavenEvents;
@@ -225,6 +226,8 @@
                 new BuildFailureException(
                     e.getMessage(),
                     e ) );
+
+            return result;
         }
 
         // old doExecute

Modified: maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java?rev=572210&r1=572209&r2=572210&view=diff
==============================================================================
--- maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java (original)
+++ maven/components/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java Sun Sep  2 18:39:28 2007
@@ -271,7 +271,7 @@
             {
                 transferListener = new BatchModeDownloadMonitor();
             }
-            
+
             transferListener.setShowChecksumEvents( false );
 
             // This means to scan a directory structure for POMs and process them.
@@ -348,14 +348,14 @@
 
         if ( cvr.isUserSettingsFilePresent() && !cvr.isUserSettingsFileParses() )
         {
-            showFatalError( "Error reading user settings: " + cvr.getUserSettingsException().getMessage(), cvr.getUserSettingsException(), showErrors );
+            showError( "Error reading user settings: ", cvr.getUserSettingsException(), showErrors );
 
             return 1;
         }
 
         if ( cvr.isGlobalSettingsFilePresent() && !cvr.isGlobalSettingsFileParses() )
         {
-            showFatalError( "Error reading global settings: " + cvr.getGlobalSettingsException().getMessage(), cvr.getGlobalSettingsException(), showErrors );
+            showError( "Error reading global settings: ", cvr.getGlobalSettingsException(), showErrors );
 
             return 1;
         }
@@ -375,17 +375,16 @@
         }
         catch ( MavenEmbedderException e )
         {
-            showFatalError( "Unable to start the embedded plexus container", e, showErrors );
+            showError( "Unable to start the embedder: ", e, showErrors );
 
             return 1;
         }
 
-
         MavenExecutionResult result = mavenEmbedder.execute( request );
 
         if ( result.hasExceptions() )
-        {                        
-            showFatalError( "Unable to configure the Maven application", (Exception) result.getExceptions().get( 0 ), showErrors );
+        {
+            showError( (Exception) result.getExceptions().get( 0 ), showErrors );
 
             return 1;
         }
@@ -393,21 +392,10 @@
         return 0;
     }
 
-    private static void showFatalError( String message,
-                                        Exception e,
-                                        boolean show )
+    private static void showError( Exception e,
+                                   boolean show )
     {
-        System.err.println( "FATAL ERROR: " + message );
-        if ( show )
-        {
-            System.err.println( "Error stacktrace:" );
-
-            e.printStackTrace();
-        }
-        else
-        {
-            System.err.println( "For more information, run with the -e flag" );
-        }
+        showError( e.getMessage(), e, show );
     }
 
     private static void showError( String message,
@@ -415,11 +403,16 @@
                                    boolean show )
     {
         System.err.println( message );
+
         if ( show )
         {
             System.err.println( "Error stacktrace:" );
 
             e.printStackTrace();
+        }
+        else
+        {
+            System.err.println( "For more information, run with the -e flag" );
         }
     }