mirror of https://github.com/apache/maven.git
more error diagnostics improvements
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@320869 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
937d0d933f
commit
1c7c34f027
|
@ -133,7 +133,7 @@ public class DefaultWagonManager
|
|||
}
|
||||
catch ( UnsupportedProtocolException e )
|
||||
{
|
||||
throw new TransferFailedException( "Unsupported Protocol: ", e );
|
||||
throw new TransferFailedException( "Unsupported Protocol: '" + protocol + "': " + e.getMessage(), e );
|
||||
}
|
||||
|
||||
if ( downloadMonitor != null )
|
||||
|
@ -156,7 +156,7 @@ public class DefaultWagonManager
|
|||
}
|
||||
catch ( NoSuchAlgorithmException e )
|
||||
{
|
||||
throw new TransferFailedException( "Unable to add checksum methods", e );
|
||||
throw new TransferFailedException( "Unable to add checksum methods: " + e.getMessage(), e );
|
||||
}
|
||||
|
||||
try
|
||||
|
@ -204,23 +204,23 @@ public class DefaultWagonManager
|
|||
}
|
||||
catch ( ConnectionException e )
|
||||
{
|
||||
throw new TransferFailedException( "Connection failed: ", e );
|
||||
throw new TransferFailedException( "Connection failed: " + e.getMessage(), e );
|
||||
}
|
||||
catch ( AuthenticationException e )
|
||||
{
|
||||
throw new TransferFailedException( "Authentication failed: ", e );
|
||||
throw new TransferFailedException( "Authentication failed: " + e.getMessage(), e );
|
||||
}
|
||||
catch ( AuthorizationException e )
|
||||
{
|
||||
throw new TransferFailedException( "Authorization failed: ", e );
|
||||
throw new TransferFailedException( "Authorization failed: " + e.getMessage(), e );
|
||||
}
|
||||
catch ( ResourceDoesNotExistException e )
|
||||
{
|
||||
throw new TransferFailedException( "Resource to deploy not found: ", e );
|
||||
throw new TransferFailedException( "Resource to deploy not found: " + e.getMessage(), e );
|
||||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new TransferFailedException( "Error creating temporary file for deployment: ", e );
|
||||
throw new TransferFailedException( "Error creating temporary file for deployment: " + e.getMessage(), e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -320,7 +320,7 @@ public class DefaultWagonManager
|
|||
}
|
||||
catch ( UnsupportedProtocolException e )
|
||||
{
|
||||
throw new TransferFailedException( "Unsupported Protocol: ", e );
|
||||
throw new TransferFailedException( "Unsupported Protocol: '" + protocol + "': " + e.getMessage(), e );
|
||||
}
|
||||
|
||||
if ( downloadMonitor != null )
|
||||
|
@ -341,7 +341,7 @@ public class DefaultWagonManager
|
|||
}
|
||||
catch ( NoSuchAlgorithmException e )
|
||||
{
|
||||
throw new TransferFailedException( "Unable to add checksum methods", e );
|
||||
throw new TransferFailedException( "Unable to add checksum methods: " + e.getMessage(), e );
|
||||
}
|
||||
|
||||
File temp = new File( destination + ".tmp" );
|
||||
|
@ -436,15 +436,15 @@ public class DefaultWagonManager
|
|||
}
|
||||
catch ( ConnectionException e )
|
||||
{
|
||||
throw new TransferFailedException( "Connection failed: ", e );
|
||||
throw new TransferFailedException( "Connection failed: " + e.getMessage(), e );
|
||||
}
|
||||
catch ( AuthenticationException e )
|
||||
{
|
||||
throw new TransferFailedException( "Authentication failed: ", e );
|
||||
throw new TransferFailedException( "Authentication failed: " + e.getMessage(), e );
|
||||
}
|
||||
catch ( AuthorizationException e )
|
||||
{
|
||||
throw new TransferFailedException( "Authorization failed: ", e );
|
||||
throw new TransferFailedException( "Authorization failed: " + e.getMessage(), e );
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
@ -474,7 +474,8 @@ public class DefaultWagonManager
|
|||
}
|
||||
catch ( IOException e )
|
||||
{
|
||||
throw new TransferFailedException( "Error copying temporary file to the final destination: ", e );
|
||||
throw new TransferFailedException(
|
||||
"Error copying temporary file to the final destination: " + e.getMessage(), e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.apache.maven.artifact.Artifact;
|
|||
import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
|
||||
import org.apache.maven.artifact.installer.ArtifactInstallationException;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
@ -31,7 +32,7 @@ public class DefaultArtifactTransformationManager
|
|||
private List artifactTransformations;
|
||||
|
||||
public void transformForResolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
|
||||
throws ArtifactResolutionException
|
||||
throws ArtifactResolutionException, ArtifactNotFoundException
|
||||
{
|
||||
for ( Iterator i = artifactTransformations.iterator(); i.hasNext(); )
|
||||
{
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.apache.maven.artifact.Artifact;
|
|||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException;
|
||||
import org.apache.maven.artifact.repository.metadata.Versioning;
|
||||
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -28,7 +29,7 @@ public class LatestArtifactTransformation
|
|||
extends AbstractVersionTransformation
|
||||
{
|
||||
public void transformForResolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
|
||||
throws ArtifactResolutionException
|
||||
throws ArtifactResolutionException, ArtifactNotFoundException
|
||||
{
|
||||
if ( Artifact.LATEST_VERSION.equals( artifact.getVersion() ) )
|
||||
{
|
||||
|
@ -37,7 +38,7 @@ public class LatestArtifactTransformation
|
|||
String version = resolveVersion( artifact, localRepository, remoteRepositories );
|
||||
if ( Artifact.LATEST_VERSION.equals( version ) )
|
||||
{
|
||||
throw new ArtifactResolutionException( "Unable to determine the latest version", artifact );
|
||||
throw new ArtifactNotFoundException( "Unable to determine the latest version", artifact );
|
||||
}
|
||||
|
||||
artifact.setBaseVersion( version );
|
||||
|
|
|
@ -22,6 +22,7 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
|
|||
import org.apache.maven.artifact.repository.metadata.ArtifactRepositoryMetadata;
|
||||
import org.apache.maven.artifact.repository.metadata.RepositoryMetadataResolutionException;
|
||||
import org.apache.maven.artifact.repository.metadata.Versioning;
|
||||
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -36,7 +37,7 @@ public class ReleaseArtifactTransformation
|
|||
extends AbstractVersionTransformation
|
||||
{
|
||||
public void transformForResolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
|
||||
throws ArtifactResolutionException
|
||||
throws ArtifactResolutionException, ArtifactNotFoundException
|
||||
{
|
||||
if ( Artifact.RELEASE_VERSION.equals( artifact.getVersion() ) )
|
||||
{
|
||||
|
@ -46,7 +47,7 @@ public class ReleaseArtifactTransformation
|
|||
|
||||
if ( Artifact.RELEASE_VERSION.equals( version ) )
|
||||
{
|
||||
throw new ArtifactResolutionException( "Unable to determine the release version", artifact );
|
||||
throw new ArtifactNotFoundException( "Unable to determine the release version", artifact );
|
||||
}
|
||||
|
||||
artifact.setBaseVersion( version );
|
||||
|
|
|
@ -19,6 +19,7 @@ package org.apache.maven.artifact.resolver;
|
|||
import org.apache.maven.artifact.Artifact;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -161,7 +162,7 @@ public class AbstractArtifactResolutionException
|
|||
sb.append( "from the specified remote repositories:" );
|
||||
sb.append( LS + " " );
|
||||
|
||||
for ( Iterator i = remoteRepositories.iterator(); i.hasNext(); )
|
||||
for ( Iterator i = new HashSet( remoteRepositories ).iterator(); i.hasNext(); )
|
||||
{
|
||||
ArtifactRepository remoteRepository = (ArtifactRepository) i.next();
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ public class ArtifactNotFoundException
|
|||
{
|
||||
private String downloadUrl;
|
||||
|
||||
protected ArtifactNotFoundException( String message, Artifact artifact )
|
||||
public ArtifactNotFoundException( String message, Artifact artifact )
|
||||
{
|
||||
this( message, artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion(), artifact.getType(), null,
|
||||
null );
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.apache.maven.artifact.Artifact;
|
|||
import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
|
||||
import org.apache.maven.artifact.installer.ArtifactInstallationException;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -42,7 +43,7 @@ public interface ArtifactTransformation
|
|||
* @param localRepository the local repository
|
||||
*/
|
||||
void transformForResolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
|
||||
throws ArtifactResolutionException;
|
||||
throws ArtifactResolutionException, ArtifactNotFoundException;
|
||||
|
||||
/**
|
||||
* Take in a artifact and return the transformed artifact for locating in the local repository. If no
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.apache.maven.artifact.Artifact;
|
|||
import org.apache.maven.artifact.deployer.ArtifactDeploymentException;
|
||||
import org.apache.maven.artifact.installer.ArtifactInstallationException;
|
||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||
import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
|
||||
import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -40,7 +41,7 @@ public interface ArtifactTransformationManager
|
|||
* @param localRepository the local repository
|
||||
*/
|
||||
void transformForResolve( Artifact artifact, List remoteRepositories, ArtifactRepository localRepository )
|
||||
throws ArtifactResolutionException;
|
||||
throws ArtifactResolutionException, ArtifactNotFoundException;
|
||||
|
||||
/**
|
||||
* Take in a artifact and return the transformed artifact for locating in the local repository. If no
|
||||
|
|
|
@ -17,7 +17,6 @@ package org.apache.maven.plugin;
|
|||
*/
|
||||
|
||||
import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||
import org.apache.maven.usability.diagnostics.DiagnosisUtils;
|
||||
import org.apache.maven.usability.plugin.Expression;
|
||||
import org.apache.maven.usability.plugin.ExpressionDocumentationException;
|
||||
import org.apache.maven.usability.plugin.ExpressionDocumenter;
|
||||
|
@ -273,11 +272,7 @@ public class PluginConfigurationException
|
|||
addParameterUsageInfo( value, message );
|
||||
}
|
||||
|
||||
message.append( "Reason: " ).append( cce.getMessage() ).append( "\n" );
|
||||
|
||||
Throwable root = DiagnosisUtils.getRootCause( cce );
|
||||
|
||||
message.append( "Root Cause: " ).append( root.getMessage() ).append( "\n\n" );
|
||||
message.append( "\n\nCause: " ).append( cce.getMessage() );
|
||||
|
||||
return message.toString();
|
||||
}
|
||||
|
|
|
@ -215,8 +215,7 @@ public class DefaultPluginVersionManager
|
|||
// if we still haven't found a version, then fail early before we get into the update goop.
|
||||
if ( StringUtils.isEmpty( version ) )
|
||||
{
|
||||
throw new PluginVersionNotFoundException( groupId, artifactId,
|
||||
"Failed to resolve a valid version for this plugin" );
|
||||
throw new PluginVersionNotFoundException( groupId, artifactId );
|
||||
}
|
||||
|
||||
// if the plugin registry is inactive, then the rest of this goop is useless...
|
||||
|
|
|
@ -23,9 +23,9 @@ public class PluginVersionNotFoundException
|
|||
|
||||
private final String artifactId;
|
||||
|
||||
public PluginVersionNotFoundException( String groupId, String artifactId, String baseMessage )
|
||||
public PluginVersionNotFoundException( String groupId, String artifactId )
|
||||
{
|
||||
super( "Error resolving version for \'" + groupId + ":" + artifactId + "\': " + baseMessage );
|
||||
super( "The plugin \'" + groupId + ":" + artifactId + "\' does not exist or no valid version could be found" );
|
||||
|
||||
this.groupId = groupId;
|
||||
this.artifactId = artifactId;
|
||||
|
|
|
@ -34,8 +34,8 @@ public class ArtifactNotFoundDiagnoser
|
|||
|
||||
public String diagnose( Throwable error )
|
||||
{
|
||||
ArtifactNotFoundException exception = (ArtifactNotFoundException) DiagnosisUtils.getFromCausality( error,
|
||||
ArtifactNotFoundException.class );
|
||||
ArtifactNotFoundException exception =
|
||||
(ArtifactNotFoundException) DiagnosisUtils.getFromCausality( error, ArtifactNotFoundException.class );
|
||||
|
||||
StringBuffer message = new StringBuffer();
|
||||
|
||||
|
@ -51,13 +51,6 @@ public class ArtifactNotFoundDiagnoser
|
|||
message.append( "\n" ).append( SystemWarnings.getOfflineWarning() );
|
||||
}
|
||||
|
||||
Throwable root = DiagnosisUtils.getRootCause( exception );
|
||||
|
||||
if ( root != null )
|
||||
{
|
||||
message.append( "\nRoot Cause: " ).append( root.getMessage() );
|
||||
}
|
||||
|
||||
message.append( "\n" );
|
||||
|
||||
return message.toString();
|
||||
|
|
|
@ -34,8 +34,8 @@ public class ArtifactResolverDiagnoser
|
|||
|
||||
public String diagnose( Throwable error )
|
||||
{
|
||||
ArtifactResolutionException exception = (ArtifactResolutionException) DiagnosisUtils.getFromCausality( error,
|
||||
ArtifactResolutionException.class );
|
||||
ArtifactResolutionException exception =
|
||||
(ArtifactResolutionException) DiagnosisUtils.getFromCausality( error, ArtifactResolutionException.class );
|
||||
|
||||
StringBuffer message = new StringBuffer();
|
||||
|
||||
|
@ -48,13 +48,6 @@ public class ArtifactResolverDiagnoser
|
|||
message.append( "\n" ).append( SystemWarnings.getOfflineWarning() );
|
||||
}
|
||||
|
||||
Throwable root = DiagnosisUtils.getRootCause( exception );
|
||||
|
||||
if ( root != null )
|
||||
{
|
||||
message.append( "\nRoot Cause: " ).append( root.getMessage() );
|
||||
}
|
||||
|
||||
message.append( "\n" );
|
||||
|
||||
return message.toString();
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package org.apache.maven.usability;
|
||||
|
||||
import org.apache.maven.artifact.InvalidArtifactRTException;
|
||||
import org.apache.maven.usability.diagnostics.ErrorDiagnoser;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
|
@ -19,6 +16,9 @@ import org.apache.maven.usability.diagnostics.ErrorDiagnoser;
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import org.apache.maven.artifact.InvalidArtifactRTException;
|
||||
import org.apache.maven.usability.diagnostics.ErrorDiagnoser;
|
||||
|
||||
public class InvalidArtifactDiagnoser
|
||||
implements ErrorDiagnoser
|
||||
{
|
||||
|
@ -35,13 +35,13 @@ public class InvalidArtifactDiagnoser
|
|||
InvalidArtifactRTException e = (InvalidArtifactRTException) error;
|
||||
|
||||
diagnosis.append( "An invalid artifact was detected.\n\n" )
|
||||
.append( "This artifact might be in your project's POM, ")
|
||||
.append( "or it might have been included transitively during the resolution process. ")
|
||||
.append( "Here is the information we do have for this artifact:\n")
|
||||
.append( "\n o GroupID: ").append( maybeFlag( e.getGroupId() ) )
|
||||
.append( "\n o ArtifactID: ").append( maybeFlag( e.getArtifactId() ) )
|
||||
.append( "\n o Version: ").append( maybeFlag( e.getVersion() ) )
|
||||
.append( "\n o Type: ").append( maybeFlag( e.getType() ) )
|
||||
.append( "This artifact might be in your project's POM, " )
|
||||
.append( "or it might have been included transitively during the resolution process. " )
|
||||
.append( "Here is the information we do have for this artifact:\n" )
|
||||
.append( "\n o GroupID: " ).append( maybeFlag( e.getGroupId() ) )
|
||||
.append( "\n o ArtifactID: " ).append( maybeFlag( e.getArtifactId() ) )
|
||||
.append( "\n o Version: " ).append( maybeFlag( e.getVersion() ) )
|
||||
.append( "\n o Type: " ).append( maybeFlag( e.getType() ) )
|
||||
.append( "\n" );
|
||||
|
||||
return diagnosis.toString();
|
||||
|
@ -49,7 +49,7 @@ public class InvalidArtifactDiagnoser
|
|||
|
||||
private String maybeFlag( String value )
|
||||
{
|
||||
if( value == null || value.trim().length() < 1 )
|
||||
if ( value == null || value.trim().length() < 1 )
|
||||
{
|
||||
return "<<< MISSING >>>";
|
||||
}
|
||||
|
|
|
@ -1,5 +1,21 @@
|
|||
package org.apache.maven.usability;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed 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 org.apache.maven.plugin.MojoExecutionException;
|
||||
import org.apache.maven.usability.diagnostics.DiagnosisUtils;
|
||||
import org.apache.maven.usability.diagnostics.ErrorDiagnoser;
|
||||
|
@ -15,7 +31,8 @@ public class MojoExecutionExceptionDiagnoser
|
|||
|
||||
public String diagnose( Throwable error )
|
||||
{
|
||||
MojoExecutionException mee = (MojoExecutionException) DiagnosisUtils.getFromCausality( error, MojoExecutionException.class );
|
||||
MojoExecutionException mee =
|
||||
(MojoExecutionException) DiagnosisUtils.getFromCausality( error, MojoExecutionException.class );
|
||||
|
||||
StringBuffer message = new StringBuffer();
|
||||
|
||||
|
@ -31,7 +48,7 @@ public class MojoExecutionExceptionDiagnoser
|
|||
message.append( ".\n" );
|
||||
}
|
||||
|
||||
message.append( "\nMessage: " ).append( mee.getMessage() );
|
||||
message.append( "\n" ).append( mee.getMessage() );
|
||||
|
||||
String longMessage = mee.getLongMessage();
|
||||
if ( longMessage != null )
|
||||
|
@ -39,15 +56,6 @@ public class MojoExecutionExceptionDiagnoser
|
|||
message.append( "\n\n" ).append( longMessage );
|
||||
}
|
||||
|
||||
Throwable root = DiagnosisUtils.getRootCause( mee );
|
||||
|
||||
if ( root != null && root != mee )
|
||||
{
|
||||
message.append( "\n\nRoot Cause: " ).append( root.getMessage() );
|
||||
}
|
||||
|
||||
message.append( "\n\n" );
|
||||
|
||||
return message.toString();
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,60 @@
|
|||
package org.apache.maven.usability;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed 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 org.apache.maven.plugin.MojoFailureException;
|
||||
import org.apache.maven.usability.diagnostics.DiagnosisUtils;
|
||||
import org.apache.maven.usability.diagnostics.ErrorDiagnoser;
|
||||
|
||||
public class MojoFailureExceptionDiagnoser
|
||||
implements ErrorDiagnoser
|
||||
{
|
||||
|
||||
public boolean canDiagnose( Throwable error )
|
||||
{
|
||||
return DiagnosisUtils.containsInCausality( error, MojoFailureExceptionDiagnoser.class );
|
||||
}
|
||||
|
||||
public String diagnose( Throwable error )
|
||||
{
|
||||
MojoFailureException mfe =
|
||||
(MojoFailureException) DiagnosisUtils.getFromCausality( error, MojoFailureException.class );
|
||||
|
||||
StringBuffer message = new StringBuffer();
|
||||
|
||||
Object source = mfe.getSource();
|
||||
if ( source != null )
|
||||
{
|
||||
message.append( ": " ).append( mfe.getSource() ).append( "\n" );
|
||||
}
|
||||
else
|
||||
{
|
||||
message.append( ".\n" );
|
||||
}
|
||||
|
||||
message.append( "\n" ).append( mfe.getMessage() );
|
||||
|
||||
String longMessage = mfe.getLongMessage();
|
||||
if ( longMessage != null )
|
||||
{
|
||||
message.append( "\n\n" ).append( longMessage );
|
||||
}
|
||||
|
||||
return message.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +1,21 @@
|
|||
package org.apache.maven.usability;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed 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 org.apache.maven.profiles.activation.ProfileActivationException;
|
||||
import org.apache.maven.usability.diagnostics.DiagnosisUtils;
|
||||
import org.apache.maven.usability.diagnostics.ErrorDiagnoser;
|
||||
|
@ -16,7 +32,8 @@ public class ProfileActivationDiagnoser
|
|||
|
||||
public String diagnose( Throwable error )
|
||||
{
|
||||
ProfileActivationException activationException = (ProfileActivationException) DiagnosisUtils.getFromCausality( error, ProfileActivationException.class );
|
||||
ProfileActivationException activationException =
|
||||
(ProfileActivationException) DiagnosisUtils.getFromCausality( error, ProfileActivationException.class );
|
||||
|
||||
StringBuffer messageBuffer = new StringBuffer();
|
||||
|
||||
|
@ -25,19 +42,13 @@ public class ProfileActivationDiagnoser
|
|||
|
||||
if ( DiagnosisUtils.containsInCausality( activationException, ComponentLookupException.class ) )
|
||||
{
|
||||
ComponentLookupException cle = (ComponentLookupException) DiagnosisUtils.getFromCausality( activationException, ComponentLookupException.class );
|
||||
ComponentLookupException cle = (ComponentLookupException) DiagnosisUtils.getFromCausality(
|
||||
activationException, ComponentLookupException.class );
|
||||
|
||||
messageBuffer.append( "\n\nThere was a problem retrieving one or more profile activators." );
|
||||
messageBuffer.append( "\n" ).append( cle.getMessage() );
|
||||
}
|
||||
|
||||
Throwable root = DiagnosisUtils.getRootCause( error );
|
||||
|
||||
if ( root != null && root != error )
|
||||
{
|
||||
messageBuffer.append( "\n\nRoot Cause: " ).append( root.getMessage() );
|
||||
}
|
||||
|
||||
messageBuffer.append( "\n" );
|
||||
|
||||
return messageBuffer.toString();
|
||||
|
|
|
@ -1,5 +1,21 @@
|
|||
package org.apache.maven.usability;
|
||||
|
||||
/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed 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 org.apache.maven.project.InvalidProjectModelException;
|
||||
import org.apache.maven.project.ProjectBuildingException;
|
||||
import org.apache.maven.project.validation.ModelValidationResult;
|
||||
|
@ -17,7 +33,8 @@ public class ProjectBuildDiagnoser
|
|||
|
||||
public String diagnose( Throwable error )
|
||||
{
|
||||
ProjectBuildingException pbe = (ProjectBuildingException) DiagnosisUtils.getFromCausality( error, ProjectBuildingException.class );
|
||||
ProjectBuildingException pbe =
|
||||
(ProjectBuildingException) DiagnosisUtils.getFromCausality( error, ProjectBuildingException.class );
|
||||
|
||||
StringBuffer message = new StringBuffer();
|
||||
|
||||
|
@ -41,13 +58,6 @@ public class ProjectBuildDiagnoser
|
|||
|
||||
message.append( "\n\n" ).append( "Reason: " ).append( pbe.getMessage() );
|
||||
|
||||
Throwable t = DiagnosisUtils.getRootCause( error );
|
||||
|
||||
if ( t != null && t != pbe )
|
||||
{
|
||||
message.append( "\n" ).append( "Root Cause: " ).append( t.getMessage() );
|
||||
}
|
||||
|
||||
message.append( "\n\n" );
|
||||
|
||||
return message.toString();
|
||||
|
|
|
@ -1,4 +1,18 @@
|
|||
package org.apache.maven.usability;
|
||||
package org.apache.maven.usability;/*
|
||||
* Copyright 2001-2005 The Apache Software Foundation.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
|
||||
public class SystemWarnings
|
||||
{
|
||||
|
|
|
@ -102,6 +102,16 @@
|
|||
</component>
|
||||
<!--
|
||||
|
|
||||
|MojoFailureExceptionDiagnoser
|
||||
|
|
||||
-->
|
||||
<component>
|
||||
<role>org.apache.maven.usability.diagnostics.ErrorDiagnoser</role>
|
||||
<role-hint>MojoFailureExceptionDiagnoser</role-hint>
|
||||
<implementation>org.apache.maven.usability.MojoFailureExceptionDiagnoser</implementation>
|
||||
</component>
|
||||
<!--
|
||||
|
|
||||
|ProjectBuildDiagnoser
|
||||
|
|
||||
-->
|
||||
|
|
|
@ -114,7 +114,8 @@ public class ErrorDiagnostics
|
|||
this.container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
|
||||
}
|
||||
|
||||
private static class PuntErrorDiagnoser implements ErrorDiagnoser
|
||||
private static class PuntErrorDiagnoser
|
||||
implements ErrorDiagnoser
|
||||
{
|
||||
|
||||
public boolean canDiagnose( Throwable error )
|
||||
|
@ -126,17 +127,7 @@ public class ErrorDiagnostics
|
|||
{
|
||||
StringBuffer message = new StringBuffer();
|
||||
|
||||
message.append( "Error: " ).append( error.getClass().getName() );
|
||||
message.append( "\nMessage: " ).append( error.getMessage() );
|
||||
|
||||
Throwable root = DiagnosisUtils.getRootCause( error );
|
||||
|
||||
if ( root != null && root != error )
|
||||
{
|
||||
message.append( "\n\nRoot Cause\n\n" );
|
||||
message.append( "Error: " ).append( root.getClass().getName() );
|
||||
message.append( "\nMessage: " ).append( root.getMessage() );
|
||||
}
|
||||
message.append( error.getMessage() );
|
||||
|
||||
return message.toString();
|
||||
}
|
||||
|
|
|
@ -156,8 +156,7 @@ public class DeployMojo
|
|||
}
|
||||
catch ( ArtifactDeploymentException e )
|
||||
{
|
||||
throw new MojoExecutionException(
|
||||
"Error deploying artifact '" + artifact.getDependencyConflictId() + "': " + e.getMessage(), e );
|
||||
throw new MojoExecutionException( e.getMessage(), e );
|
||||
}
|
||||
}
|
||||
}
|
|
@ -125,8 +125,7 @@ public class InstallMojo
|
|||
}
|
||||
catch ( ArtifactInstallationException e )
|
||||
{
|
||||
throw new MojoExecutionException(
|
||||
"Error installing artifact '" + artifact.getDependencyConflictId() + "': " + e.getMessage(), e );
|
||||
throw new MojoExecutionException( e.getMessage(), e );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -472,7 +472,7 @@ public class DefaultMavenProjectBuilder
|
|||
|
||||
private Model createStubModel( Artifact projectArtifact )
|
||||
{
|
||||
getLogger().warn( "\n ***** Using defaults for missing POM " + projectArtifact + " *****\n" );
|
||||
getLogger().debug( "Using defaults for missing POM " + projectArtifact );
|
||||
|
||||
Model model = new Model();
|
||||
model.setModelVersion( "4.0.0" );
|
||||
|
|
Loading…
Reference in New Issue