You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by jd...@apache.org on 2005/05/09 06:25:58 UTC
svn commit: r169230 -
/maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it
/maven/components/trunk/maven-core/src/main/java/org/apache/maven
/maven/components/trunk/maven-core/src/main/java/org/apache/maven/cli
Author: jdcasey
Date: Sun May 8 21:25:56 2005
New Revision: 169230
URL: http://svn.apache.org/viewcvs?rev=169230&view=rev
Log:
o Added '-e' switch, to allow error stacktraces without enabling DEBUG error level throughout.
o Added listing of error messages from getCause() chain in DefaultMaven rather than simply spitting out the (often useless) aggregator Exception's message.
o Added '-e' to the IT verifier's invocation of m2.
I'm trying to get visibility to errors here...
Modified:
maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.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/cli/MavenCli.java
Modified: maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java
URL: http://svn.apache.org/viewcvs/maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java?rev=169230&r1=169229&r2=169230&view=diff
==============================================================================
--- maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java (original)
+++ maven/components/trunk/maven-core-it-verifier/src/main/java/org/apache/maven/it/Verifier.java Sun May 8 21:25:56 2005
@@ -436,6 +436,8 @@
}
cli.setExecutable( executable );
+
+ cli.createArgument().setValue( "-e" );
for ( Iterator i = allGoals.iterator(); i.hasNext(); )
{
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=169230&r1=169229&r2=169230&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 May 8 21:25:56 2005
@@ -379,8 +379,21 @@
getLogger().info( "Reason: " + e.getMessage() );
+ getLogger().info( "Found these embedded error messages:\n" );
+
+ Throwable cause = e.getCause();
+
+ int depth = 0;
+
+ while( cause != null )
+ {
+ getLogger().info( "\t[" + ( depth++ ) + "] " + cause.getMessage() );
+
+ cause = cause.getCause();
+ }
+
line();
-
+
if ( longMessage != null )
{
getLogger().info( longMessage );
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=169230&r1=169229&r2=169230&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 Sun May 8 21:25:56 2005
@@ -117,7 +117,14 @@
initializeSystemProperties( commandLine );
boolean debug = commandLine.hasOption( CLIManager.DEBUG );
+
+ boolean showErrors = debug || commandLine.hasOption( CLIManager.ERRORS );
+ if(showErrors)
+ {
+ System.out.println("+ Error stacktraces are turned on.");
+ }
+
// ----------------------------------------------------------------------
// Process particular command line options
// ----------------------------------------------------------------------
@@ -149,7 +156,7 @@
}
catch ( PlexusContainerException e )
{
- showFatalError( "Unable to start the embedded plexus container", e, debug );
+ showFatalError( "Unable to start the embedded plexus container", e, showErrors );
return 1;
}
@@ -162,17 +169,17 @@
}
catch ( IOException e )
{
- showFatalError( "Unable to read settings.xml", e, debug );
+ showFatalError( "Unable to read settings.xml", e, showErrors );
return 1;
}
catch ( XmlPullParserException e )
{
- showFatalError( "Unable to read settings.xml", e, debug );
+ showFatalError( "Unable to read settings.xml", e, showErrors );
return 1;
}
catch ( ComponentLookupException e )
{
- showFatalError( "Unable to read settings.xml", e, debug );
+ showFatalError( "Unable to read settings.xml", e, showErrors );
return 1;
}
@@ -183,7 +190,7 @@
}
catch ( IOException e )
{
- showFatalError( "Error locating project files for reactor execution", e, debug );
+ showFatalError( "Error locating project files for reactor execution", e, showErrors );
return 1;
}
@@ -204,7 +211,7 @@
}
catch ( ComponentLookupException e )
{
- showFatalError( "Unable to configure the Maven application", e, debug );
+ showFatalError( "Unable to configure the Maven application", e, showErrors );
return 1;
}
@@ -224,7 +231,7 @@
}
catch ( ReactorException e )
{
- showFatalError( "Error executing Maven for a project", e, debug );
+ showFatalError( "Error executing Maven for a project", e, showErrors );
return 1;
}
@@ -238,11 +245,13 @@
}
}
- private static void showFatalError( String message, Exception e, boolean debug )
+ private static void showFatalError( String message, Exception e, boolean show )
{
System.err.println( "FATAL ERROR: " + message );
- if ( debug )
+ if ( show )
{
+ System.err.println("Error stacktrace:");
+
e.printStackTrace();
}
else
@@ -441,6 +450,9 @@
public static final char REACTOR = 'r';
public static final char DEBUG = 'X';
+
+ // TODO: [jc] Is there a better switch than '-e' for this?
+ public static final char ERRORS = 'e';
public static final char HELP = 'h';
@@ -469,6 +481,8 @@
VERSION ) );
options.addOption( OptionBuilder.withLongOpt( "debug" ).withDescription( "Produce execution debug output" ).create(
DEBUG ) );
+ options.addOption( OptionBuilder.withLongOpt( "errors" ).withDescription( "Produce execution error messages" ).create(
+ ERRORS ) );
options.addOption( OptionBuilder.withLongOpt( "reactor" ).withDescription(
"Execute goals for project found in the reactor" ).create( REACTOR ) );
options.addOption( OptionBuilder.withLongOpt( "non-recursive" ).withDescription(
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org