Fix some problems with the CLI reporter when the reactor manager hasn't been created yet (in cases where reading the projects for the reactor failed, for instance).

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@613039 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2008-01-18 01:56:20 +00:00
parent facb56d1eb
commit a0297f1d5b
2 changed files with 13 additions and 16 deletions

View File

@ -1,16 +1,5 @@
package org.apache.maven.cli;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.Properties;
import java.util.TimeZone;
import org.apache.maven.embedder.MavenEmbedderConsoleLogger;
import org.apache.maven.embedder.MavenEmbedderLogger;
import org.apache.maven.errors.CoreErrorReporter;
@ -22,9 +11,19 @@ import org.apache.maven.lifecycle.LifecycleExecutionException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.ProjectBuildingException;
import org.apache.maven.reactor.MavenExecutionException;
import org.codehaus.plexus.util.Os;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.Properties;
import java.util.TimeZone;
/**
* Utility class used to report errors, statistics, application version info, etc.
*
@ -96,7 +95,7 @@ public final class CLIReportingUtils
logReactorSummary( reactorManager, logger );
boolean printSuccess = true;
if ( ( reactorManager != null ) && reactorManager.hasBuildFailures() )
if ( ( reactorManager == null ) || reactorManager.hasBuildFailures() )
{
for ( Iterator i = result.getExceptions().iterator(); i.hasNext(); )
{
@ -112,7 +111,7 @@ public final class CLIReportingUtils
line( logger );
}
if ( !ReactorManager.FAIL_NEVER.equals( reactorManager.getFailureBehavior() ) )
if ( ( reactorManager != null ) && !ReactorManager.FAIL_NEVER.equals( reactorManager.getFailureBehavior() ) )
{
logger.info( "BUILD FAILED" );

View File

@ -17,7 +17,6 @@ import org.apache.maven.execution.MavenExecutionResult;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.plugin.PluginManagerException;
import org.apache.maven.settings.Settings;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
import org.easymock.MockControl;
@ -578,7 +577,6 @@ public class ErrorReporterPointcutTest
MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( project )
.setShowErrors( true )
.setLoggingLevel( Logger.LEVEL_DEBUG )
.setSettings( settings )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {