You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by be...@apache.org on 2009/10/20 23:08:09 UTC
svn commit: r827792 - in /maven/maven-3/trunk:
maven-compat/src/main/java/org/apache/maven/artifact/resolver/
maven-compat/src/main/java/org/apache/maven/repository/
maven-compat/src/main/java/org/apache/maven/repository/legacy/
maven-core/src/main/jav...
Author: bentmann
Date: Tue Oct 20 21:08:08 2009
New Revision: 827792
URL: http://svn.apache.org/viewvc?rev=827792&view=rev
Log:
[MNG-4186] Provide an exact pointer to documentation specific to each known exception that can occur
Added:
maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/repository/LocalRepositoryNotAccessibleException.java (with props)
Modified:
maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/artifact/resolver/AbstractArtifactResolutionException.java
maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/exception/ExceptionSummary.java
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionResult.java
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionResult.java
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/BuildPluginManager.java
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginManager.java
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginContainerException.java
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginResolutionException.java
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java
maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java
maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
Modified: maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/artifact/resolver/AbstractArtifactResolutionException.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/artifact/resolver/AbstractArtifactResolutionException.java?rev=827792&r1=827791&r2=827792&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/artifact/resolver/AbstractArtifactResolutionException.java (original)
+++ maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/artifact/resolver/AbstractArtifactResolutionException.java Tue Oct 20 21:08:08 2009
@@ -78,7 +78,7 @@
Throwable t )
{
super( constructMessageBase( message, groupId, artifactId, version, type, remoteRepositories, path ), t );
-
+
this.originalMessage = message;
this.groupId = groupId;
this.artifactId = artifactId;
@@ -196,50 +196,55 @@
StringBuilder sb = new StringBuilder();
sb.append( message );
- sb.append( LS );
- sb.append( " " + groupId + ":" + artifactId + ":" + type + ":" + version );
- sb.append( LS );
- if ( remoteRepositories != null )
+
+ if ( message == null || !message.contains( "from the specified remote repositories:" ) )
{
sb.append( LS );
- sb.append( "from the specified remote repositories:" );
- sb.append( LS + " " );
-
- if ( remoteRepositories.isEmpty() )
- {
- sb.append( "(none)" );
- }
-
- for ( Iterator<ArtifactRepository> i = remoteRepositories.iterator(); i.hasNext(); )
+ sb.append( " " + groupId + ":" + artifactId + ":" + type + ":" + version );
+ sb.append( LS );
+ if ( remoteRepositories != null )
{
- ArtifactRepository remoteRepository = i.next();
-
- sb.append( remoteRepository.getId() );
- sb.append( " (" );
- sb.append( remoteRepository.getUrl() );
+ sb.append( LS );
+ sb.append( "from the specified remote repositories:" );
+ sb.append( LS + " " );
- ArtifactRepositoryPolicy releases = remoteRepository.getReleases();
- if ( releases != null )
+ if ( remoteRepositories.isEmpty() )
{
- sb.append( ", releases=" ).append( releases.isEnabled() );
+ sb.append( "(none)" );
}
- ArtifactRepositoryPolicy snapshots = remoteRepository.getSnapshots();
- if ( snapshots != null )
+ for ( Iterator<ArtifactRepository> i = remoteRepositories.iterator(); i.hasNext(); )
{
- sb.append( ", snapshots=" ).append( snapshots.isEnabled() );
- }
+ ArtifactRepository remoteRepository = i.next();
- sb.append( ")" );
- if ( i.hasNext() )
- {
- sb.append( "," ).append( LS ).append( " " );
+ sb.append( remoteRepository.getId() );
+ sb.append( " (" );
+ sb.append( remoteRepository.getUrl() );
+
+ ArtifactRepositoryPolicy releases = remoteRepository.getReleases();
+ if ( releases != null )
+ {
+ sb.append( ", releases=" ).append( releases.isEnabled() );
+ }
+
+ ArtifactRepositoryPolicy snapshots = remoteRepository.getSnapshots();
+ if ( snapshots != null )
+ {
+ sb.append( ", snapshots=" ).append( snapshots.isEnabled() );
+ }
+
+ sb.append( ")" );
+ if ( i.hasNext() )
+ {
+ sb.append( "," ).append( LS ).append( " " );
+ }
}
}
+
+ sb.append( constructArtifactPath( path, "" ) );
+ sb.append( LS );
}
- sb.append( constructArtifactPath( path, "" ) );
- sb.append( LS );
return sb.toString();
}
Added: maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/repository/LocalRepositoryNotAccessibleException.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/repository/LocalRepositoryNotAccessibleException.java?rev=827792&view=auto
==============================================================================
--- maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/repository/LocalRepositoryNotAccessibleException.java (added)
+++ maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/repository/LocalRepositoryNotAccessibleException.java Tue Oct 20 21:08:08 2009
@@ -0,0 +1,44 @@
+package org.apache.maven.repository;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+import java.io.IOException;
+
+/**
+ * Signals a failure to store files within the local repository.
+ *
+ * @author Benjamin Bentmann
+ */
+public class LocalRepositoryNotAccessibleException
+ extends IOException
+{
+
+ public LocalRepositoryNotAccessibleException( String message, Throwable cause )
+ {
+ super( message );
+ initCause( cause );
+ }
+
+ public LocalRepositoryNotAccessibleException( String message )
+ {
+ super( message );
+ }
+
+}
Propchange: maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/repository/LocalRepositoryNotAccessibleException.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/repository/LocalRepositoryNotAccessibleException.java
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java?rev=827792&r1=827791&r2=827792&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java (original)
+++ maven/maven-3/trunk/maven-compat/src/main/java/org/apache/maven/repository/legacy/DefaultWagonManager.java Tue Oct 20 21:08:08 2009
@@ -122,6 +122,8 @@
public void getArtifact( Artifact artifact, List<ArtifactRepository> remoteRepositories, TransferListener downloadMonitor, boolean force )
throws TransferFailedException, ResourceDoesNotExistException
{
+ TransferFailedException tfe = null;
+
for ( ArtifactRepository repository : remoteRepositories )
{
try
@@ -139,18 +141,29 @@
// This one we will eat when looking through remote repositories
// because we want to cycle through them all before squawking.
- logger.debug( "Unable to find resource '" + artifact.getId() + "' in repository " + repository.getId() + " (" + repository.getUrl() + ")", e );
+ logger.debug( "Unable to find resource '" + artifact.getId() + "' in repository " + repository.getId()
+ + " (" + repository.getUrl() + ")", e );
}
catch ( TransferFailedException e )
{
- logger.debug( "Unable to get resource '" + artifact.getId() + "' from repository " + repository.getId() + " (" + repository.getUrl() + ")", e );
+ tfe = e;
+
+ logger.debug( "Unable to get resource '" + artifact.getId() + "' from repository " + repository.getId()
+ + " (" + repository.getUrl() + ")", e );
}
}
// if it already exists locally we were just trying to force it - ignore the update
if ( !artifact.getFile().exists() )
{
- throw new ResourceDoesNotExistException( "Unable to download the artifact from any repository" );
+ if ( tfe != null )
+ {
+ throw tfe;
+ }
+ else
+ {
+ throw new ResourceDoesNotExistException( "Unable to download the artifact from any repository" );
+ }
}
}
Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java?rev=827792&r1=827791&r2=827792&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/DefaultMaven.java Tue Oct 20 21:08:08 2009
@@ -29,9 +29,6 @@
import java.util.Map;
import org.apache.maven.artifact.ArtifactUtils;
-import org.apache.maven.exception.DefaultExceptionHandler;
-import org.apache.maven.exception.ExceptionHandler;
-import org.apache.maven.exception.ExceptionSummary;
import org.apache.maven.execution.DefaultLifecycleEvent;
import org.apache.maven.execution.DefaultMavenExecutionResult;
import org.apache.maven.execution.DuplicateProjectException;
@@ -50,6 +47,7 @@
import org.apache.maven.project.ProjectBuildingRequest;
import org.apache.maven.project.ProjectBuildingResult;
import org.apache.maven.repository.DelegatingLocalArtifactRepository;
+import org.apache.maven.repository.LocalRepositoryNotAccessibleException;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
@@ -92,14 +90,18 @@
public MavenExecutionResult execute( MavenExecutionRequest request )
{
+ MavenExecutionResult result;
+
try
{
- return doExecute( request );
+ result = doExecute( request );
}
catch ( OutOfMemoryError e )
{
- return processResult( new DefaultMavenExecutionResult(), e );
+ result = processResult( new DefaultMavenExecutionResult(), e );
}
+
+ return result;
}
private MavenExecutionResult doExecute( MavenExecutionRequest request )
@@ -113,8 +115,18 @@
request.setStartTime( new Date() );
MavenExecutionResult result = new DefaultMavenExecutionResult();
-
- DelegatingLocalArtifactRepository delegatingLocalArtifactRepository = new DelegatingLocalArtifactRepository( request.getLocalRepository() );
+
+ try
+ {
+ validateLocalRepository( request );
+ }
+ catch ( LocalRepositoryNotAccessibleException e )
+ {
+ return processResult( result, e );
+ }
+
+ DelegatingLocalArtifactRepository delegatingLocalArtifactRepository =
+ new DelegatingLocalArtifactRepository( request.getLocalRepository() );
request.setLocalRepository( delegatingLocalArtifactRepository );
@@ -229,6 +241,18 @@
return result;
}
+ private void validateLocalRepository( MavenExecutionRequest request )
+ throws LocalRepositoryNotAccessibleException
+ {
+ File localRepoDir = request.getLocalRepositoryPath();
+ localRepoDir.mkdirs();
+
+ if ( !localRepoDir.isDirectory() )
+ {
+ throw new LocalRepositoryNotAccessibleException( "Could not create local repository at " + localRepoDir );
+ }
+ }
+
private Collection<AbstractMavenLifecycleParticipant> getLifecycleParticipants( Collection<MavenProject> projects )
{
Collection<AbstractMavenLifecycleParticipant> lifecycleListeners =
@@ -279,17 +303,11 @@
private MavenExecutionResult processResult( MavenExecutionResult result, Throwable e )
{
- ExceptionHandler handler = new DefaultExceptionHandler();
-
- ExceptionSummary es = handler.handleException( e );
-
if ( !result.getExceptions().contains( e ) )
{
result.addException( e );
}
-
- result.setExceptionSummary( es );
-
+
return result;
}
Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java?rev=827792&r1=827791&r2=827792&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/exception/DefaultExceptionHandler.java Tue Oct 20 21:08:08 2009
@@ -19,16 +19,17 @@
* under the License.
*/
-import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
-import org.apache.maven.plugin.CycleDetectedInPluginGraphException;
+import java.net.UnknownHostException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.maven.model.building.ModelProblem;
+import org.apache.maven.plugin.AbstractMojoExecutionException;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.MojoNotFoundException;
-import org.apache.maven.plugin.PluginDescriptorParsingException;
-import org.apache.maven.plugin.PluginNotFoundException;
-import org.apache.maven.plugin.PluginResolutionException;
-import org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException;
+import org.apache.maven.plugin.PluginExecutionException;
+import org.apache.maven.project.ProjectBuildingException;
+import org.apache.maven.project.ProjectBuildingResult;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.util.StringUtils;
@@ -79,73 +80,162 @@
public class DefaultExceptionHandler
implements ExceptionHandler
{
+
public ExceptionSummary handleException( Throwable exception )
{
- String message;
-
- String reference = "http://";
-
- // Plugin problems
- if ( exception instanceof PluginNotFoundException )
+ return handle( "", exception );
+ }
+
+ private ExceptionSummary handle( String message, Throwable exception )
+ {
+ String reference = getReference( exception );
+
+ List<ExceptionSummary> children = null;
+
+ if ( exception instanceof ProjectBuildingException )
{
- message = exception.getMessage();
+ List<ProjectBuildingResult> results = ( (ProjectBuildingException) exception ).getResults();
+
+ children = new ArrayList<ExceptionSummary>();
+
+ for ( ProjectBuildingResult result : results )
+ {
+ ExceptionSummary child = handle( result );
+ if ( child != null )
+ {
+ children.add( child );
+ }
+ }
+
+ message = "The build could not read " + children.size() + " project" + ( children.size() == 1 ? "" : "s" );
}
- else if ( exception instanceof PluginResolutionException )
+ else
{
- message = exception.getMessage();
+ message = getMessage( message, exception );
}
- else if ( exception instanceof PluginDescriptorParsingException )
+
+ return new ExceptionSummary( exception, message, reference, children );
+ }
+
+ private ExceptionSummary handle( ProjectBuildingResult result )
+ {
+ List<ExceptionSummary> children = new ArrayList<ExceptionSummary>();
+
+ for ( ModelProblem problem : result.getProblems() )
{
- message = exception.getMessage();
+ ExceptionSummary child = handle( problem );
+ if ( child != null )
+ {
+ children.add( child );
+ }
}
- else if ( exception instanceof CycleDetectedInPluginGraphException )
- {
- message = exception.getMessage();
- }
- else if ( exception instanceof NoPluginFoundForPrefixException )
+
+ if ( children.isEmpty() )
{
- message = exception.getMessage();
+ return null;
}
-
- // Project dependency downloading problems.
- else if ( exception instanceof ArtifactNotFoundException )
+
+ String message =
+ "The project " + result.getProjectId() + " (" + result.getPomFile() + ") has " + children.size() + " error"
+ + ( children.size() == 1 ? "" : "s" );
+
+ return new ExceptionSummary( null, message, null, children );
+ }
+
+ private ExceptionSummary handle( ModelProblem problem )
+ {
+ if ( ModelProblem.Severity.ERROR.compareTo( problem.getSeverity() ) >= 0 )
{
- message = exception.getMessage();
+ return handle( problem.getMessage(), problem.getException() );
}
- else if ( exception instanceof ArtifactResolutionException )
- {
- message = exception.getMessage();
- }
-
- // Mojo problems
- else if ( exception instanceof MojoNotFoundException )
+ else
{
- message = exception.getMessage();
- }
- else if ( exception instanceof MojoFailureException )
+ return null;
+ }
+ }
+
+ private String getReference( Throwable exception )
+ {
+ String reference = "";
+
+ if ( exception != null )
{
- message = ((MojoFailureException)exception).getLongMessage();
+ if ( exception instanceof MojoExecutionException )
+ {
+ reference = MojoExecutionException.class.getSimpleName();
+ }
+ else if ( exception instanceof MojoFailureException )
+ {
+ reference = MojoFailureException.class.getSimpleName();
+ }
+ else if ( exception instanceof LinkageError )
+ {
+ reference = LinkageError.class.getSimpleName();
+ }
+ else if ( exception instanceof PluginExecutionException )
+ {
+ reference = getReference( exception.getCause() );
- if ( StringUtils.isEmpty( message ) )
+ if ( StringUtils.isEmpty( reference ) )
+ {
+ reference = exception.getClass().getSimpleName();
+ }
+ }
+ else if ( !( exception instanceof RuntimeException ) )
{
- message = exception.getMessage();
+ reference = exception.getClass().getSimpleName();
}
}
- else if ( exception instanceof MojoExecutionException )
+
+ if ( StringUtils.isNotEmpty( reference ) && !reference.startsWith( "http:" ) )
+ {
+ reference = "http://cwiki.apache.org/confluence/display/MAVEN/" + reference;
+ }
+
+ return reference;
+ }
+
+ private String getMessage( String message, Throwable exception )
+ {
+ String fullMessage = ( message != null ) ? message : "";
+
+ for ( Throwable t = exception; t != null; t = t.getCause() )
{
- message = ((MojoExecutionException)exception).getLongMessage();
+ String exceptionMessage = t.getMessage();
+
+ if ( t instanceof AbstractMojoExecutionException )
+ {
+ String longMessage = ( (AbstractMojoExecutionException) t ).getLongMessage();
+ if ( StringUtils.isNotEmpty( longMessage ) )
+ {
+ exceptionMessage = longMessage;
+ }
+ }
- if ( StringUtils.isEmpty( message ) )
+ if ( t instanceof UnknownHostException && !fullMessage.contains( "host" ) )
{
- message = exception.getMessage();
+ if ( fullMessage.length() > 0 )
+ {
+ fullMessage += ": ";
+ }
+ fullMessage += "Unknown host " + exceptionMessage;
+ }
+ else if ( !fullMessage.contains( exceptionMessage ) )
+ {
+ if ( fullMessage.length() > 0 )
+ {
+ fullMessage += ": ";
+ }
+ fullMessage += exceptionMessage;
}
}
-
- else
+
+ if ( StringUtils.isEmpty( fullMessage ) && exception != null )
{
- message = exception.getMessage();
- }
-
- return new ExceptionSummary( exception, message, reference );
+ fullMessage = exception.toString();
+ }
+
+ return fullMessage.trim();
}
+
}
Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/exception/ExceptionSummary.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/exception/ExceptionSummary.java?rev=827792&r1=827791&r2=827792&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/exception/ExceptionSummary.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/exception/ExceptionSummary.java Tue Oct 20 21:08:08 2009
@@ -19,6 +19,9 @@
* under the License.
*/
+import java.util.Collections;
+import java.util.List;
+
// provide a
// - the exception
// - useful message
@@ -28,17 +31,26 @@
public class ExceptionSummary
{
+
private Throwable exception;
-
+
private String message;
-
+
private String reference;
+ private List<ExceptionSummary> children;
+
public ExceptionSummary( Throwable exception, String message, String reference )
{
+ this( exception, message, reference, null );
+ }
+
+ public ExceptionSummary( Throwable exception, String message, String reference, List<ExceptionSummary> children )
+ {
this.exception = exception;
- this.message = message;
- this.reference = reference;
+ this.message = ( message != null ) ? message : "";
+ this.reference = ( reference != null ) ? reference : "";
+ this.children = ( children != null ) ? children : Collections.<ExceptionSummary> emptyList();
}
public Throwable getException()
@@ -54,5 +66,11 @@
public String getReference()
{
return reference;
- }
+ }
+
+ public List<ExceptionSummary> getChildren()
+ {
+ return children;
+ }
+
}
Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java?rev=827792&r1=827791&r2=827792&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java Tue Oct 20 21:08:08 2009
@@ -426,6 +426,11 @@
{
this.localRepository = localRepository;
+ if ( localRepository != null )
+ {
+ setLocalRepositoryPath( new File( localRepository.getBasedir() ).getAbsoluteFile() );
+ }
+
return this;
}
Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionResult.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionResult.java?rev=827792&r1=827791&r2=827792&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionResult.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionResult.java Tue Oct 20 21:08:08 2009
@@ -26,7 +26,6 @@
import java.util.Map;
import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
-import org.apache.maven.exception.ExceptionSummary;
import org.apache.maven.project.MavenProject;
/** @author Jason van Zyl */
@@ -41,8 +40,6 @@
private List<Throwable> exceptions;
- private ExceptionSummary exceptionSummary;
-
private Map<MavenProject, BuildSummary> buildSummaries;
public MavenExecutionResult setProject( MavenProject project )
@@ -103,18 +100,6 @@
return !getExceptions().isEmpty();
}
- public MavenExecutionResult setExceptionSummary( ExceptionSummary exceptionSummary )
- {
- this.exceptionSummary = exceptionSummary;
-
- return this;
- }
-
- public ExceptionSummary getExceptionSummary()
- {
- return exceptionSummary;
- }
-
public BuildSummary getBuildSummary( MavenProject project )
{
return ( buildSummaries != null ) ? buildSummaries.get( project ) : null;
Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionResult.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionResult.java?rev=827792&r1=827791&r2=827792&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionResult.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionResult.java Tue Oct 20 21:08:08 2009
@@ -49,9 +49,6 @@
MavenExecutionResult addException( Throwable e );
boolean hasExceptions();
-
- MavenExecutionResult setExceptionSummary( ExceptionSummary exceptionSummary );
- ExceptionSummary getExceptionSummary();
/**
* Gets the build summary for the specified project.
Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/BuildPluginManager.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/BuildPluginManager.java?rev=827792&r1=827791&r2=827792&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/BuildPluginManager.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/BuildPluginManager.java Tue Oct 20 21:08:08 2009
@@ -36,7 +36,7 @@
throws PluginNotFoundException, PluginResolutionException, PluginDescriptorParsingException, MojoNotFoundException, InvalidPluginDescriptorException;
ClassRealm getPluginRealm( MavenSession session, PluginDescriptor pluginDescriptor )
- throws PluginManagerException;
+ throws PluginResolutionException, PluginManagerException;
void executeMojo( MavenSession session, MojoExecution execution )
throws MojoFailureException, MojoExecutionException, PluginConfigurationException, PluginManagerException;
Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java?rev=827792&r1=827791&r2=827792&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/DefaultBuildPluginManager.java Tue Oct 20 21:08:08 2009
@@ -19,7 +19,6 @@
import java.io.PrintStream;
import org.apache.maven.artifact.repository.RepositoryRequest;
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.model.Plugin;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
@@ -75,7 +74,16 @@
Mojo mojo = null;
- ClassRealm pluginRealm = getPluginRealm( session, mojoDescriptor.getPluginDescriptor() );
+ ClassRealm pluginRealm;
+ try
+ {
+ pluginRealm = getPluginRealm( session, mojoDescriptor.getPluginDescriptor() );
+ }
+ catch ( PluginResolutionException e )
+ {
+ throw new PluginExecutionException( mojoExecution, project, e );
+ }
+
ClassRealm oldLookupRealm = container.getLookupRealm();
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();
@@ -110,22 +118,36 @@
{
throw new PluginExecutionException( mojoExecution, project, e );
}
+ catch ( NoClassDefFoundError e )
+ {
+ ByteArrayOutputStream os = new ByteArrayOutputStream( 1024 );
+ PrintStream ps = new PrintStream( os );
+ ps.println( "A required class was missing while executing " + mojoDescriptor.getId() + ": "
+ + e.getMessage() );
+ pluginRealm.display( ps );
+
+ Exception wrapper = new PluginContainerException( mojoDescriptor, pluginRealm, os.toString(), e );
+
+ throw new PluginExecutionException( mojoExecution, project, wrapper );
+ }
catch ( LinkageError e )
{
ByteArrayOutputStream os = new ByteArrayOutputStream( 1024 );
PrintStream ps = new PrintStream( os );
- ps.println( "A linkage error occured while executing " + mojoDescriptor.getId() );
- ps.println( e );
+ ps.println( "An API incompatibility was encountered while executing " + mojoDescriptor.getId() + ": "
+ + e.getClass().getName() + ": " + e.getMessage() );
pluginRealm.display( ps );
- throw new PluginExecutionException( mojoExecution, project, os.toString(), e );
+ Exception wrapper = new PluginContainerException( mojoDescriptor, pluginRealm, os.toString(), e );
+
+ throw new PluginExecutionException( mojoExecution, project, wrapper );
}
catch ( ClassCastException e )
{
ByteArrayOutputStream os = new ByteArrayOutputStream( 1024 );
PrintStream ps = new PrintStream( os );
- ps.println( "A type incompatibility occured while executing " + mojoDescriptor.getId() );
- ps.println( e );
+ ps.println( "A type incompatibility occured while executing " + mojoDescriptor.getId() + ": "
+ + e.getMessage() );
pluginRealm.display( ps );
throw new PluginExecutionException( mojoExecution, project, os.toString(), e );
@@ -148,10 +170,10 @@
/**
* TODO pluginDescriptor classRealm and artifacts are set as a side effect of this
* call, which is not nice.
- * @throws ArtifactResolutionException
+ * @throws PluginResolutionException
*/
public ClassRealm getPluginRealm( MavenSession session, PluginDescriptor pluginDescriptor )
- throws PluginManagerException
+ throws PluginResolutionException, PluginManagerException
{
ClassRealm pluginRealm = pluginDescriptor.getClassRealm();
if ( pluginRealm != null )
@@ -159,17 +181,8 @@
return pluginRealm;
}
- Plugin plugin = pluginDescriptor.getPlugin();
-
- try
- {
- mavenPluginManager.setupPluginRealm( pluginDescriptor, session,
- session.getCurrentProject().getClassRealm(), null );
- }
- catch ( PluginResolutionException e )
- {
- throw new PluginManagerException( plugin, e.getMessage(), e );
- }
+ mavenPluginManager.setupPluginRealm( pluginDescriptor, session, session.getCurrentProject().getClassRealm(),
+ null );
return pluginDescriptor.getClassRealm();
}
Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginManager.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginManager.java?rev=827792&r1=827791&r2=827792&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginManager.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/MavenPluginManager.java Tue Oct 20 21:08:08 2009
@@ -74,7 +74,7 @@
*/
void setupPluginRealm( PluginDescriptor pluginDescriptor, MavenSession session, ClassLoader parent,
List<String> imports )
- throws PluginResolutionException, PluginManagerException;
+ throws PluginResolutionException, PluginContainerException;
/**
* Looks up the mojo for the specified mojo execution and populates its parameters from the configuration given by
Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginContainerException.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginContainerException.java?rev=827792&r1=827791&r2=827792&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginContainerException.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginContainerException.java Tue Oct 20 21:08:08 2009
@@ -42,6 +42,13 @@
private ClassRealm pluginRealm;
+ public PluginContainerException( MojoDescriptor mojoDescriptor, ClassRealm pluginRealm, String message, Throwable e )
+ {
+ super( mojoDescriptor, message, e );
+
+ this.pluginRealm = pluginRealm;
+ }
+
public PluginContainerException( MojoDescriptor mojoDescriptor, ClassRealm pluginRealm, String message, ComponentLookupException e )
{
super( mojoDescriptor, message, e );
@@ -49,6 +56,13 @@
this.pluginRealm = pluginRealm;
}
+ public PluginContainerException( Plugin plugin, ClassRealm pluginRealm, String message, Throwable e )
+ {
+ super( plugin, message, e );
+
+ this.pluginRealm = pluginRealm;
+ }
+
public PluginContainerException( Plugin plugin, ClassRealm pluginRealm, String message, PlexusConfigurationException e )
{
super( plugin, message, e );
Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginResolutionException.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginResolutionException.java?rev=827792&r1=827791&r2=827792&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginResolutionException.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/PluginResolutionException.java Tue Oct 20 21:08:08 2009
@@ -36,8 +36,9 @@
public PluginResolutionException( Plugin plugin, ArtifactResolutionException e )
{
- super( "Plugin or one of its dependencies could not be resolved: " + e.getMessage(), e.getGroupId(),
- e.getArtifactId(), e.getVersion(), e.getType(), null, e.getRemoteRepositories(), null, e.getCause() );
+ super( "Plugin " + plugin.getId() + " or one of its dependencies could not be resolved: " + e.getMessage(),
+ e.getGroupId(), e.getArtifactId(), e.getVersion(), e.getType(), null, e.getRemoteRepositories(), null,
+ e );
this.plugin = plugin;
}
Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java?rev=827792&r1=827791&r2=827792&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/plugin/internal/DefaultMavenPluginManager.java Tue Oct 20 21:08:08 2009
@@ -20,10 +20,12 @@
*/
import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.io.PrintStream;
import java.io.Reader;
import java.net.MalformedURLException;
import java.util.ArrayList;
@@ -63,7 +65,6 @@
import org.apache.maven.plugin.PluginContainerException;
import org.apache.maven.plugin.PluginDescriptorCache;
import org.apache.maven.plugin.PluginDescriptorParsingException;
-import org.apache.maven.plugin.PluginManagerException;
import org.apache.maven.plugin.PluginParameterExpressionEvaluator;
import org.apache.maven.plugin.PluginRealmCache;
import org.apache.maven.plugin.PluginResolutionException;
@@ -290,7 +291,7 @@
public synchronized void setupPluginRealm( PluginDescriptor pluginDescriptor, MavenSession session,
ClassLoader parent, List<String> imports )
- throws PluginResolutionException, PluginManagerException
+ throws PluginResolutionException, PluginContainerException
{
Plugin plugin = pluginDescriptor.getPlugin();
@@ -319,8 +320,8 @@
}
private void createPluginRealm( PluginDescriptor pluginDescriptor, MavenSession session, ClassLoader parent,
- List<String> imports )
- throws PluginResolutionException, PluginManagerException
+ List<String> imports )
+ throws PluginResolutionException, PluginContainerException
{
Plugin plugin = pluginDescriptor.getPlugin();
@@ -401,13 +402,13 @@
}
catch ( PlexusConfigurationException e )
{
- throw new PluginManagerException( plugin, "Error in component graph of plugin " + plugin.getId() + ": "
- + e.getMessage(), e );
+ throw new PluginContainerException( plugin, pluginRealm, "Error in component graph of plugin "
+ + plugin.getId() + ": " + e.getMessage(), e );
}
catch ( CycleDetectedInComponentGraphException e )
{
- throw new PluginManagerException( plugin, "Error in component graph of plugin " + plugin.getId() + ": "
- + e.getMessage(), e );
+ throw new PluginContainerException( plugin, pluginRealm, "Error in component graph of plugin "
+ + plugin.getId() + ": " + e.getMessage(), e );
}
}
@@ -497,13 +498,28 @@
if ( ( cause instanceof NoClassDefFoundError ) || ( cause instanceof ClassNotFoundException ) )
{
- throw new PluginContainerException( mojoDescriptor, pluginRealm, "Unable to load the mojo '"
- + mojoDescriptor.getGoal() + "' in the plugin '" + pluginDescriptor.getId()
- + "'. A required class is missing: " + cause.getMessage(), e );
+ ByteArrayOutputStream os = new ByteArrayOutputStream( 1024 );
+ PrintStream ps = new PrintStream( os );
+ ps.println( "Unable to load the mojo '" + mojoDescriptor.getGoal() + "' in the plugin '"
+ + pluginDescriptor.getId() + "'. A required class is missing: " + cause.getMessage() );
+ pluginRealm.display( ps );
+
+ throw new PluginContainerException( mojoDescriptor, pluginRealm, os.toString(), cause );
}
+ else if ( cause instanceof LinkageError )
+ {
+ ByteArrayOutputStream os = new ByteArrayOutputStream( 1024 );
+ PrintStream ps = new PrintStream( os );
+ ps.println( "Unable to load the mojo '" + mojoDescriptor.getGoal() + "' in the plugin '"
+ + pluginDescriptor.getId() + "' due to an API incompatibility: " + e.getClass().getName()
+ + ": " + cause.getMessage() );
+ pluginRealm.display( ps );
- throw new PluginContainerException( mojoDescriptor, pluginRealm, "Unable to find the mojo '"
- + mojoDescriptor.getGoal() + "' (or one of its required components) in the plugin '"
+ throw new PluginContainerException( mojoDescriptor, pluginRealm, os.toString(), cause );
+ }
+
+ throw new PluginContainerException( mojoDescriptor, pluginRealm, "Unable to load the mojo '"
+ + mojoDescriptor.getGoal() + "' (or one of its required components) from the plugin '"
+ pluginDescriptor.getId() + "'", e );
}
@@ -596,46 +612,23 @@
}
catch ( NoClassDefFoundError e )
{
- throw new PluginConfigurationException( mojoDescriptor.getPluginDescriptor(),
- "A required class was missing during configuration of mojo "
- + mojoDescriptor.getId() + ": " + e.getMessage(), e );
+ ByteArrayOutputStream os = new ByteArrayOutputStream( 1024 );
+ PrintStream ps = new PrintStream( os );
+ ps.println( "A required class was missing during configuration of mojo " + mojoDescriptor.getId() + ": "
+ + e.getMessage() );
+ pluginRealm.display( ps );
+
+ throw new PluginConfigurationException( mojoDescriptor.getPluginDescriptor(), os.toString(), e );
}
catch ( LinkageError e )
{
- if ( logger.isFatalErrorEnabled() )
- {
- logger.fatalError( configurator.getClass().getName()
- + "#configureComponent(...) caused a linkage error (" + e.getClass().getName()
- + ") and may be out-of-date. Check the realms:" );
-
- StringBuilder sb = new StringBuilder();
- sb.append( "Plugin realm = " + pluginRealm.getId() ).append( '\n' );
- for ( int i = 0; i < pluginRealm.getURLs().length; i++ )
- {
- sb.append( "urls[" + i + "] = " + pluginRealm.getURLs()[i] );
- if ( i != ( pluginRealm.getURLs().length - 1 ) )
- {
- sb.append( '\n' );
- }
- }
- logger.fatalError( sb.toString() );
-
- ClassRealm containerRealm = container.getContainerRealm();
- sb = new StringBuilder();
- sb.append( "Container realm = " + containerRealm.getId() ).append( '\n' );
- for ( int i = 0; i < containerRealm.getURLs().length; i++ )
- {
- sb.append( "urls[" + i + "] = " + containerRealm.getURLs()[i] );
- if ( i != ( containerRealm.getURLs().length - 1 ) )
- {
- sb.append( '\n' );
- }
- }
- logger.fatalError( sb.toString() );
- }
+ ByteArrayOutputStream os = new ByteArrayOutputStream( 1024 );
+ PrintStream ps = new PrintStream( os );
+ ps.println( "An API incompatibility was encountered during configuration of mojo " + mojoDescriptor.getId()
+ + ": " + e.getClass().getName() + ": " + e.getMessage() );
+ pluginRealm.display( ps );
- throw new PluginConfigurationException( mojoDescriptor.getPluginDescriptor(), e.getClass().getName() + ": "
- + e.getMessage(), new ComponentConfigurationException( e ) );
+ throw new PluginConfigurationException( mojoDescriptor.getPluginDescriptor(), os.toString(), e );
}
finally
{
Modified: maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java?rev=827792&r1=827791&r2=827792&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java (original)
+++ maven/maven-3/trunk/maven-core/src/main/java/org/apache/maven/project/DefaultModelBuildingListener.java Tue Oct 20 21:08:08 2009
@@ -118,11 +118,11 @@
}
catch ( PluginResolutionException e )
{
- event.getProblems().addError( "Unresolveable build extensions: " + e.getMessage(), e );
+ event.getProblems().addError( "Unresolveable build extension: " + e.getMessage(), e );
}
catch ( PluginVersionResolutionException e )
{
- event.getProblems().addError( "Unresolveable build extensions: " + e.getMessage(), e );
+ event.getProblems().addError( "Unresolveable build extension: " + e.getMessage(), e );
}
if ( project.getClassRealm() != null )
Modified: maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
URL: http://svn.apache.org/viewvc/maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java?rev=827792&r1=827791&r2=827792&view=diff
==============================================================================
--- maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java (original)
+++ maven/maven-3/trunk/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java Tue Oct 20 21:08:08 2009
@@ -21,7 +21,9 @@
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.Map.Entry;
@@ -29,6 +31,8 @@
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.ParseException;
import org.apache.maven.Maven;
+import org.apache.maven.exception.DefaultExceptionHandler;
+import org.apache.maven.exception.ExceptionHandler;
import org.apache.maven.exception.ExceptionSummary;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.DefaultMavenExecutionResult;
@@ -37,7 +41,6 @@
import org.apache.maven.execution.MavenExecutionRequestPopulator;
import org.apache.maven.execution.MavenExecutionResult;
import org.apache.maven.model.building.ModelProcessor;
-import org.apache.maven.model.locator.ModelLocator;
import org.apache.maven.repository.ArtifactTransferListener;
import org.apache.maven.settings.Settings;
import org.apache.maven.settings.building.DefaultSettingsBuildingRequest;
@@ -453,60 +456,101 @@
try
{
- if ( result.hasExceptions() )
+ return processResult( request, result, showErrors );
+ }
+ finally
+ {
+ if ( fileStream != null )
{
- ExceptionSummary es = result.getExceptionSummary();
+ fileStream.close();
+ }
+ }
+ }
- if ( es == null )
- {
- logger.error( "", result.getExceptions().get( 0 ) );
- }
- else
- {
- if ( showErrors )
- {
- logger.error( es.getMessage(), es.getException() );
- }
- else
- {
- logger.error( es.getMessage() );
- logger.error( "To see the full stack trace of the error, re-run Maven with the -e switch." );
- }
+ private int processResult( MavenExecutionRequest request, MavenExecutionResult result, boolean showErrors )
+ {
+ if ( result.hasExceptions() )
+ {
+ ExceptionHandler handler = new DefaultExceptionHandler();
- logger.error( "Re-run Maven using the -X switch to enable full debug logging." );
+ Map<String, String> references = new LinkedHashMap<String, String>();
- if ( StringUtils.isNotEmpty( es.getReference() ) )
- {
- logger.error( "" );
- logger.error( "For more information about the error and possible solutions"
- + ", please try the following article:" );
- logger.error( " " + es.getReference() );
- }
- }
+ for ( Throwable exception : result.getExceptions() )
+ {
+ ExceptionSummary summary = handler.handleException( exception );
- if ( MavenExecutionRequest.REACTOR_FAIL_NEVER.equals( request.getReactorFailureBehavior() ) )
- {
- logger.info( "Build failures were ignored." );
+ logSummary( summary, references, "", showErrors );
+ }
- return 0;
- }
- else
+ logger.error( "" );
+
+ if ( !showErrors )
+ {
+ logger.error( "To see the full stack trace of the errors, re-run Maven with the -e switch." );
+ }
+ if ( !logger.isDebugEnabled() )
+ {
+ logger.error( "Re-run Maven using the -X switch to enable full debug logging." );
+ }
+
+ if ( !references.isEmpty() )
+ {
+ logger.error( "" );
+ logger.error( "For more information about the errors and possible solutions"
+ + ", please read the following articles:" );
+
+ for ( Map.Entry<String, String> entry : references.entrySet() )
{
- return 1;
+ logger.error( entry.getValue() + " " + entry.getKey() );
}
}
- else
+
+ if ( MavenExecutionRequest.REACTOR_FAIL_NEVER.equals( request.getReactorFailureBehavior() ) )
{
+ logger.info( "Build failures were ignored." );
+
return 0;
}
+ else
+ {
+ return 1;
+ }
}
- finally
+ else
{
- if ( fileStream != null )
+ return 0;
+ }
+ }
+
+ private void logSummary( ExceptionSummary summary, Map<String, String> references, String indent, boolean showErrors )
+ {
+ String referenceKey = "";
+
+ if ( StringUtils.isNotEmpty( summary.getReference() ) )
+ {
+ referenceKey = references.get( summary.getReference() );
+ if ( referenceKey == null )
{
- fileStream.close();
+ referenceKey = "[" + references.size() + "]";
+ references.put( summary.getReference(), referenceKey );
}
}
+
+ if ( showErrors )
+ {
+ logger.error( indent + referenceKey, summary.getException() );
+ }
+ else
+ {
+ logger.error( indent + summary.getMessage() + " " + referenceKey );
+ }
+
+ indent += " ";
+
+ for ( ExceptionSummary child : summary.getChildren() )
+ {
+ logSummary( child, references, indent, showErrors );
+ }
}
protected ModelProcessor createModelProcessor( PlexusContainer container )