mirror of https://github.com/apache/maven.git
PR: MNG-1098
show reactor summary on all failures git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@307224 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2bbd09083f
commit
1e8917387a
|
@ -152,19 +152,18 @@ public class DefaultMaven
|
|||
|
||||
dispatcher.dispatchStart( event, request.getBaseDirectory() );
|
||||
|
||||
ReactorManager rm;
|
||||
|
||||
ProfileManager globalProfileManager = request.getGlobalProfileManager();
|
||||
|
||||
boolean foundProjects = true;
|
||||
List projects;
|
||||
try
|
||||
{
|
||||
loadSettingsProfiles( globalProfileManager, request.getSettings() );
|
||||
|
||||
List files = getProjectFiles( request );
|
||||
|
||||
List projects = collectProjects( files, request.getLocalRepository(), request.isRecursive(),
|
||||
request.getSettings(), globalProfileManager, !request.isReactorActive() );
|
||||
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.
|
||||
|
@ -176,15 +175,6 @@ public class DefaultMaven
|
|||
|
||||
foundProjects = false;
|
||||
}
|
||||
|
||||
rm = new ReactorManager( projects );
|
||||
|
||||
String requestFailureBehavior = request.getFailureBehavior();
|
||||
|
||||
if ( requestFailureBehavior != null )
|
||||
{
|
||||
rm.setFailureBehavior( requestFailureBehavior );
|
||||
}
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
|
@ -198,11 +188,24 @@ public class DefaultMaven
|
|||
{
|
||||
return dispatchErrorResponse( dispatcher, event, request.getBaseDirectory(), e );
|
||||
}
|
||||
catch ( CycleDetectedException e )
|
||||
catch ( ProfileActivationException e )
|
||||
{
|
||||
return dispatchErrorResponse( dispatcher, event, request.getBaseDirectory(), e );
|
||||
}
|
||||
catch ( ProfileActivationException e )
|
||||
|
||||
ReactorManager rm = null;
|
||||
try
|
||||
{
|
||||
rm = new ReactorManager( projects );
|
||||
|
||||
String requestFailureBehavior = request.getFailureBehavior();
|
||||
|
||||
if ( requestFailureBehavior != null )
|
||||
{
|
||||
rm.setFailureBehavior( requestFailureBehavior );
|
||||
}
|
||||
}
|
||||
catch ( CycleDetectedException e )
|
||||
{
|
||||
return dispatchErrorResponse( dispatcher, event, request.getBaseDirectory(), e );
|
||||
}
|
||||
|
@ -228,18 +231,13 @@ public class DefaultMaven
|
|||
if ( ReactorManager.FAIL_AT_END.equals( rm.getFailureBehavior() ) &&
|
||||
exception instanceof ReactorException )
|
||||
{
|
||||
logFailure( response, exception, null );
|
||||
|
||||
if ( rm.hasMultipleProjects() && response.executedMultipleProjects() )
|
||||
{
|
||||
writeReactorSummary( rm );
|
||||
}
|
||||
logFailure( response, rm, exception, null );
|
||||
}
|
||||
else if ( exception instanceof MojoFailureException )
|
||||
{
|
||||
MojoFailureException e = (MojoFailureException) exception;
|
||||
|
||||
logFailure( response, e, e.getLongMessage() );
|
||||
logFailure( response, rm, e, e.getLongMessage() );
|
||||
}
|
||||
else if ( exception instanceof MojoExecutionException )
|
||||
{
|
||||
|
@ -248,7 +246,7 @@ public class DefaultMaven
|
|||
{
|
||||
MojoExecutionException e = (MojoExecutionException) exception;
|
||||
|
||||
logFailure( response, e, e.getLongMessage() );
|
||||
logFailure( response, rm, e, e.getLongMessage() );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -258,7 +256,7 @@ public class DefaultMaven
|
|||
}
|
||||
else if ( exception instanceof ArtifactNotFoundException )
|
||||
{
|
||||
logFailure( response, exception, null );
|
||||
logFailure( response, rm, exception, null );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -321,10 +319,14 @@ public class DefaultMaven
|
|||
{
|
||||
logReactorSummaryLine( project.getName(), "SKIPPED (dependency build failed or was skipped)" );
|
||||
}
|
||||
else
|
||||
else if ( rm.hasBuildSuccess( project ) )
|
||||
{
|
||||
logReactorSummaryLine( project.getName(), "SUCCESS" );
|
||||
}
|
||||
else
|
||||
{
|
||||
logReactorSummaryLine( project.getName(), "NOT BUILT" );
|
||||
}
|
||||
}
|
||||
|
||||
getLogger().info( "" );
|
||||
|
@ -360,7 +362,7 @@ public class DefaultMaven
|
|||
response.setStart( new Date() );
|
||||
response.setFinish( new Date() );
|
||||
response.setException( e );
|
||||
logFailure( response, e, null );
|
||||
logError( response );
|
||||
|
||||
return response;
|
||||
}
|
||||
|
@ -628,8 +630,12 @@ public class DefaultMaven
|
|||
|
||||
}
|
||||
|
||||
protected void logFailure( MavenExecutionResponse r, Throwable error, String longMessage )
|
||||
protected void logFailure( MavenExecutionResponse r, ReactorManager rm, Throwable error, String longMessage )
|
||||
{
|
||||
if ( rm.hasMultipleProjects() && r.executedMultipleProjects() )
|
||||
{
|
||||
writeReactorSummary( rm );
|
||||
}
|
||||
line();
|
||||
|
||||
getLogger().info( "BUILD FAILURE" );
|
||||
|
|
|
@ -45,31 +45,33 @@ public class ReactorManager
|
|||
private String failureBehavior = FAIL_FAST;
|
||||
|
||||
private final ProjectSorter sorter;
|
||||
|
||||
|
||||
private Map buildSuccessesByProject = new HashMap();
|
||||
|
||||
public ReactorManager( List projects )
|
||||
throws CycleDetectedException
|
||||
{
|
||||
this.sorter = new ProjectSorter( projects );
|
||||
}
|
||||
|
||||
|
||||
public Map getPluginContext( PluginDescriptor plugin, MavenProject project )
|
||||
{
|
||||
Map pluginContextsByKey = (Map) pluginContextsByProjectAndPluginKey.get( project.getId() );
|
||||
|
||||
|
||||
if ( pluginContextsByKey == null )
|
||||
{
|
||||
pluginContextsByKey = new HashMap();
|
||||
pluginContextsByProjectAndPluginKey.put( project.getId(), pluginContextsByKey );
|
||||
}
|
||||
|
||||
|
||||
Map pluginContext = (Map) pluginContextsByKey.get( plugin.getPluginLookupKey() );
|
||||
|
||||
|
||||
if ( pluginContext == null )
|
||||
{
|
||||
pluginContext = new HashMap();
|
||||
pluginContextsByKey.put( plugin.getPluginLookupKey(), pluginContext );
|
||||
}
|
||||
|
||||
|
||||
return pluginContext;
|
||||
}
|
||||
|
||||
|
@ -152,6 +154,16 @@ public class ReactorManager
|
|||
return sorter.getTopLevelProject();
|
||||
}
|
||||
|
||||
public boolean hasBuildSuccess( MavenProject project )
|
||||
{
|
||||
return buildSuccessesByProject.containsKey( project.getId() );
|
||||
}
|
||||
|
||||
public void registerBuildSuccess( MavenProject project )
|
||||
{
|
||||
buildSuccessesByProject.put( project.getId(), project );
|
||||
}
|
||||
|
||||
private static class BuildFailure
|
||||
{
|
||||
private Exception cause;
|
||||
|
|
|
@ -255,6 +255,8 @@ public class DefaultLifecycleExecutor
|
|||
}
|
||||
}
|
||||
|
||||
rm.registerBuildSuccess( rootProject );
|
||||
|
||||
dispatcher.dispatchEnd( event, rootProject.getId() + " ( " + segment + " )" );
|
||||
}
|
||||
catch ( LifecycleExecutionException e )
|
||||
|
@ -335,6 +337,8 @@ public class DefaultLifecycleExecutor
|
|||
}
|
||||
}
|
||||
|
||||
rm.registerBuildSuccess( currentProject );
|
||||
|
||||
dispatcher.dispatchEnd( event, currentProject.getId() + " ( " + segment + " )" );
|
||||
}
|
||||
catch ( LifecycleExecutionException e )
|
||||
|
|
Loading…
Reference in New Issue