diff --git a/maven-core/pom.xml b/maven-core/pom.xml
index 3990de748e..97d5adbd19 100644
--- a/maven-core/pom.xml
+++ b/maven-core/pom.xml
@@ -73,11 +73,6 @@ under the License.
org.codehaus.plexus
plexus-container-default
-
- org.apache.maven
- maven-error-diagnostics
- 2.1-SNAPSHOT
-
org.apache.maven
maven-project
diff --git a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
index 69221382fd..c0cbc16f8c 100644
--- a/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
+++ b/maven-core/src/main/java/org/apache/maven/DefaultMaven.java
@@ -48,7 +48,6 @@ import org.apache.maven.project.MavenProjectBuilder;
import org.apache.maven.project.ProjectBuildingException;
import org.apache.maven.reactor.MavenExecutionException;
import org.apache.maven.settings.Settings;
-import org.apache.maven.usability.diagnostics.ErrorDiagnostics;
import org.codehaus.plexus.PlexusConstants;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.context.Context;
@@ -90,8 +89,6 @@ public class DefaultMaven
protected PlexusContainer container;
- protected ErrorDiagnostics errorDiagnostics;
-
protected RuntimeInformation runtimeInformation;
private BuildExtensionScanner buildExtensionScanner;
diff --git a/maven-monitor/src/main/java/org/apache/maven/monitor/event/AbstractSelectiveEventMonitor.java b/maven-core/src/main/java/org/apache/maven/monitor/event/AbstractSelectiveEventMonitor.java
similarity index 100%
rename from maven-monitor/src/main/java/org/apache/maven/monitor/event/AbstractSelectiveEventMonitor.java
rename to maven-core/src/main/java/org/apache/maven/monitor/event/AbstractSelectiveEventMonitor.java
diff --git a/maven-monitor/src/main/java/org/apache/maven/monitor/event/DefaultEventDispatcher.java b/maven-core/src/main/java/org/apache/maven/monitor/event/DefaultEventDispatcher.java
similarity index 100%
rename from maven-monitor/src/main/java/org/apache/maven/monitor/event/DefaultEventDispatcher.java
rename to maven-core/src/main/java/org/apache/maven/monitor/event/DefaultEventDispatcher.java
diff --git a/maven-monitor/src/main/java/org/apache/maven/monitor/event/EventDispatcher.java b/maven-core/src/main/java/org/apache/maven/monitor/event/EventDispatcher.java
similarity index 100%
rename from maven-monitor/src/main/java/org/apache/maven/monitor/event/EventDispatcher.java
rename to maven-core/src/main/java/org/apache/maven/monitor/event/EventDispatcher.java
diff --git a/maven-monitor/src/main/java/org/apache/maven/monitor/event/EventMonitor.java b/maven-core/src/main/java/org/apache/maven/monitor/event/EventMonitor.java
similarity index 100%
rename from maven-monitor/src/main/java/org/apache/maven/monitor/event/EventMonitor.java
rename to maven-core/src/main/java/org/apache/maven/monitor/event/EventMonitor.java
diff --git a/maven-monitor/src/main/java/org/apache/maven/monitor/event/MavenEvents.java b/maven-core/src/main/java/org/apache/maven/monitor/event/MavenEvents.java
similarity index 100%
rename from maven-monitor/src/main/java/org/apache/maven/monitor/event/MavenEvents.java
rename to maven-core/src/main/java/org/apache/maven/monitor/event/MavenEvents.java
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java b/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java
index 54ab1ea5e4..c621b21ec3 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/PluginConfigurationException.java
@@ -20,22 +20,6 @@ package org.apache.maven.plugin;
*/
import org.apache.maven.plugin.descriptor.PluginDescriptor;
-import org.apache.maven.usability.plugin.Expression;
-import org.apache.maven.usability.plugin.ExpressionDocumentationException;
-import org.apache.maven.usability.plugin.ExpressionDocumenter;
-import org.codehaus.plexus.component.configurator.ComponentConfigurationException;
-import org.codehaus.plexus.configuration.PlexusConfiguration;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.StringTokenizer;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
/**
* @author Jason van Zyl
@@ -44,242 +28,26 @@ import java.util.regex.Pattern;
public class PluginConfigurationException
extends Exception
{
- private final PluginDescriptor pluginDescriptor;
+ private PluginDescriptor pluginDescriptor;
private String originalMessage;
- private static final List UNMODIFIABLE_EXPRESSIONS = Arrays.asList(
- new String[]{"localRepository", "reactorProjects", "settings", "project", "session", "plugin", "basedir"} );
-
- public PluginConfigurationException( PluginDescriptor pluginDescriptor, String message )
+ public PluginConfigurationException(
+ PluginDescriptor pluginDescriptor,
+ String originalMessage )
{
- super( "Error configuring: " + pluginDescriptor.getPluginLookupKey() + ". Reason: " + message );
+ super( originalMessage );
this.pluginDescriptor = pluginDescriptor;
- this.originalMessage = message;
+ this.originalMessage = originalMessage;
}
- public PluginConfigurationException( PluginDescriptor pluginDescriptor, Throwable cause )
+ public PluginConfigurationException(
+ PluginDescriptor pluginDescriptor,
+ String originalMessage,
+ Throwable e )
{
- super( "Error configuring: " + pluginDescriptor.getPluginLookupKey() + ".", cause );
+ super( e );
this.pluginDescriptor = pluginDescriptor;
- }
-
- public PluginConfigurationException( PluginDescriptor pluginDescriptor, String message, Throwable cause )
- {
- super( "Error configuring: " + pluginDescriptor.getPluginLookupKey() + ". Reason: " + message, cause );
- this.pluginDescriptor = pluginDescriptor;
- this.originalMessage = message;
- }
-
- public PluginDescriptor getPluginDescriptor()
- {
- return pluginDescriptor;
- }
-
- public String getOriginalMessage()
- {
- return originalMessage;
- }
-
- protected static void addParameterUsageInfo( String expression, StringBuffer messageBuffer )
- {
- StringBuffer expressionMessageBuffer = new StringBuffer();
-
- Matcher exprMatcher = Pattern.compile( "\\$\\{(.+)\\}" ).matcher( expression );
-
- boolean unmodifiableElementsFound = false;
- boolean activeElementsFound = false;
-
- int elementCount = 0;
-
- while ( exprMatcher.find() )
- {
- elementCount++;
-
- activeElementsFound = true;
-
- String subExpression = exprMatcher.group( 1 );
-
- StringTokenizer expressionParts = new StringTokenizer( subExpression, "." );
-
- String firstPart = expressionParts.nextToken();
-
- Map expressions = null;
- try
- {
- expressions = ExpressionDocumenter.load();
- }
- catch ( ExpressionDocumentationException e )
- {
- expressionMessageBuffer.append( "\n\nERROR!! Failed to load expression documentation!" );
-
- StringWriter sWriter = new StringWriter();
- PrintWriter pWriter = new PrintWriter( sWriter );
-
- e.printStackTrace( pWriter );
-
- expressionMessageBuffer.append( "\n\nException:\n\n" ).append( sWriter.toString() );
- }
-
- if ( expressions != null )
- {
- Expression expr = (Expression) expressions.get( subExpression );
-
- if ( expr != null )
- {
- if ( !expr.isEditable() )
- {
- unmodifiableElementsFound = true;
- }
- else
- {
- addParameterConfigDocumentation( firstPart, exprMatcher.group( 0 ), subExpression,
- expressionMessageBuffer, expressions );
- }
- }
- else if ( UNMODIFIABLE_EXPRESSIONS.contains( subExpression ) )
- {
- unmodifiableElementsFound = true;
- }
- else
- {
- expressionMessageBuffer.append( "on the command line, specify: \'-D" ).append( subExpression )
- .append( "=VALUE\'" );
- }
- }
- }
-
- if ( activeElementsFound )
- {
- messageBuffer.append( expressionMessageBuffer );
- }
- else
- {
- messageBuffer.append(
- " (found static expression: \'" + expression + "\' which may act as a default value).\n" );
- }
-
- if ( unmodifiableElementsFound )
- {
- if ( elementCount > 1 )
- {
- messageBuffer.append( " " );
- }
-
- messageBuffer
- .append( "NOTE: One or more purely derived expression elements were detected in \'" + expression +
- "\'.\n If you continue to get this error after any other expression elements are specified correctly," +
- "\n please report this issue to the Maven development team.\n" );
- }
- }
-
- private static void addParameterConfigDocumentation( String firstPart, String wholeExpression, String subExpression,
- StringBuffer expressionMessageBuffer, Map expressionDoco )
- {
- Expression expr = (Expression) expressionDoco.get( subExpression );
-
- if ( expr != null )
- {
- expressionMessageBuffer.append( "check that the following section of " );
- if ( "project".equals( firstPart ) )
- {
- expressionMessageBuffer.append( "the pom.xml " );
- }
- else if ( "settings".equals( firstPart ) )
- {
- expressionMessageBuffer.append( "your ~/.m2/settings.xml file " );
- }
-
- expressionMessageBuffer.append( "is present and correct:\n\n" );
-
- String message = expr.getConfiguration();
-
- if ( message == null )
- {
- message = expr.getDescription();
- }
-
- expressionMessageBuffer.append( message );
-
- Properties cliConfig = expr.getCliOptions();
-
- if ( cliConfig != null && !cliConfig.isEmpty() )
- {
- expressionMessageBuffer.append( "\n\n-OR-\n\nUse the following command-line switches:\n" );
-
- prettyPrintCommandLineSwitches( cliConfig, '.', expressionMessageBuffer );
- }
- }
- else
- {
- expressionMessageBuffer.append( "ensure that the expression: \'" + wholeExpression + "\' is satisfied" );
- }
- }
-
- private static void prettyPrintCommandLineSwitches( Properties switches, char filler,
- StringBuffer expressionMessageBuffer )
- {
- int maxKeyLen = 0;
-
- for ( Iterator it = switches.entrySet().iterator(); it.hasNext(); )
- {
- Map.Entry entry = (Map.Entry) it.next();
-
- String key = (String) entry.getKey();
-
- int keyLen = key.length();
- if ( keyLen > maxKeyLen )
- {
- maxKeyLen = keyLen;
- }
- }
-
- final int minFillerCount = 4;
-
- for ( Iterator it = switches.entrySet().iterator(); it.hasNext(); )
- {
- Map.Entry entry = (Map.Entry) it.next();
-
- String key = (String) entry.getKey();
-
- int keyLen = key.length();
-
- int fillerCount = maxKeyLen - keyLen + minFillerCount;
-
- expressionMessageBuffer.append( '\n' ).append( key ).append( ' ' );
-
- for ( int i = 0; i < fillerCount; i++ )
- {
- expressionMessageBuffer.append( filler );
- }
-
- expressionMessageBuffer.append( ' ' ).append( entry.getValue() );
- }
-
- expressionMessageBuffer.append( '\n' );
- }
-
- public String buildConfigurationDiagnosticMessage( ComponentConfigurationException cce )
- {
- StringBuffer message = new StringBuffer();
-
- PluginDescriptor descriptor = getPluginDescriptor();
-
- PlexusConfiguration failedConfiguration = cce.getFailedConfiguration();
-
- message.append( "Failed to configure plugin parameters for: " + descriptor.getId() + "\n\n" );
-
- if ( failedConfiguration != null )
- {
- String value = failedConfiguration.getValue( null );
- if ( value != null )
- {
- addParameterUsageInfo( value, message );
- }
- }
-
- message.append( "\n\nCause: " ).append( cce.getMessage() );
-
- return message.toString();
+ this.originalMessage = originalMessage;
}
}
diff --git a/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java b/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java
index 09864ee7bc..028e191ccd 100644
--- a/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java
+++ b/maven-core/src/main/java/org/apache/maven/plugin/PluginParameterException.java
@@ -94,7 +94,7 @@ public class PluginParameterException
messageBuffer.append( "\n\n-OR-\n\n" );
}
- addParameterUsageInfo( expression, messageBuffer );
+ //addParameterUsageInfo( expression, messageBuffer );
}
}
diff --git a/maven-core/src/main/java/org/apache/maven/usability/ArtifactNotFoundDiagnoser.java b/maven-core/src/main/java/org/apache/maven/usability/ArtifactNotFoundDiagnoser.java
deleted file mode 100644
index 365f1bf2c4..0000000000
--- a/maven-core/src/main/java/org/apache/maven/usability/ArtifactNotFoundDiagnoser.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.apache.maven.usability;
-
-/*
- * 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 org.apache.maven.artifact.manager.WagonManager;
-import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
-import org.apache.maven.usability.diagnostics.DiagnosisUtils;
-import org.apache.maven.usability.diagnostics.ErrorDiagnoser;
-
-public class ArtifactNotFoundDiagnoser
- implements ErrorDiagnoser
-{
-
- private WagonManager wagonManager;
-
- public boolean canDiagnose( Throwable error )
- {
- return DiagnosisUtils.containsInCausality( error, ArtifactNotFoundException.class );
- }
-
- public String diagnose( Throwable error )
- {
- ArtifactNotFoundException exception =
- (ArtifactNotFoundException) DiagnosisUtils.getFromCausality( error, ArtifactNotFoundException.class );
-
- StringBuffer message = new StringBuffer();
-
- message.append( "Failed to resolve artifact.\n" );
- message.append( "\nGroupId: " ).append( exception.getGroupId() );
- message.append( "\nArtifactId: " ).append( exception.getArtifactId() );
- message.append( "\nVersion: " ).append( exception.getVersion() );
- message.append( "\n\n" );
- message.append( "Reason: " ).append( exception.getMessage() );
-
- if ( !wagonManager.isOnline() )
- {
- message.append( "\n" ).append( SystemWarnings.getOfflineWarning() );
- }
-
- message.append( "\n" );
-
- return message.toString();
- }
-
-}
diff --git a/maven-core/src/main/java/org/apache/maven/usability/ArtifactResolverDiagnoser.java b/maven-core/src/main/java/org/apache/maven/usability/ArtifactResolverDiagnoser.java
deleted file mode 100644
index b7fc26f380..0000000000
--- a/maven-core/src/main/java/org/apache/maven/usability/ArtifactResolverDiagnoser.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.apache.maven.usability;
-
-/*
- * 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 org.apache.maven.artifact.manager.WagonManager;
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
-import org.apache.maven.usability.diagnostics.DiagnosisUtils;
-import org.apache.maven.usability.diagnostics.ErrorDiagnoser;
-
-import java.io.IOException;
-
-public class ArtifactResolverDiagnoser
- implements ErrorDiagnoser
-{
-
- private WagonManager wagonManager;
-
- public boolean canDiagnose( Throwable error )
- {
- return DiagnosisUtils.containsInCausality( error, ArtifactResolutionException.class );
- }
-
- public String diagnose( Throwable error )
- {
- ArtifactResolutionException exception =
- (ArtifactResolutionException) DiagnosisUtils.getFromCausality( error, ArtifactResolutionException.class );
-
- StringBuffer message = new StringBuffer();
-
- message.append( "Failed to resolve artifact." );
- message.append( "\n\n" );
- message.append( exception.getMessage() );
-
- IOException ioe = (IOException) DiagnosisUtils.getFromCausality( exception, IOException.class );
-
- if ( ioe != null && exception.getMessage().indexOf( ioe.getMessage() ) < 0 )
- {
- message.append( "\n\nCaused by I/O exception: " ).append( ioe.getMessage() );
- }
-
- if ( !wagonManager.isOnline() )
- {
- message.append( "\n" ).append( SystemWarnings.getOfflineWarning() );
- }
-
- message.append( "\n" );
-
- return message.toString();
- }
-
-}
diff --git a/maven-core/src/main/java/org/apache/maven/usability/InvalidArtifactDiagnoser.java b/maven-core/src/main/java/org/apache/maven/usability/InvalidArtifactDiagnoser.java
deleted file mode 100644
index c69d29ff2c..0000000000
--- a/maven-core/src/main/java/org/apache/maven/usability/InvalidArtifactDiagnoser.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.apache.maven.usability;
-
-/*
- * 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 org.apache.maven.artifact.InvalidArtifactRTException;
-import org.apache.maven.usability.diagnostics.ErrorDiagnoser;
-
-public class InvalidArtifactDiagnoser
- implements ErrorDiagnoser
-{
-
- public boolean canDiagnose( Throwable error )
- {
- return error instanceof InvalidArtifactRTException;
- }
-
- public String diagnose( Throwable error )
- {
- StringBuffer diagnosis = new StringBuffer();
-
- 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( "\n" );
-
- return diagnosis.toString();
- }
-
- private String maybeFlag( String value )
- {
- if ( value == null || value.trim().length() < 1 )
- {
- return "<<< MISSING >>>";
- }
- else
- {
- return value;
- }
- }
-
-}
diff --git a/maven-core/src/main/java/org/apache/maven/usability/MojoExecutionExceptionDiagnoser.java b/maven-core/src/main/java/org/apache/maven/usability/MojoExecutionExceptionDiagnoser.java
deleted file mode 100644
index 0a6a37bff9..0000000000
--- a/maven-core/src/main/java/org/apache/maven/usability/MojoExecutionExceptionDiagnoser.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.apache.maven.usability;
-
-/*
- * 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 org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.usability.diagnostics.DiagnosisUtils;
-import org.apache.maven.usability.diagnostics.ErrorDiagnoser;
-
-public class MojoExecutionExceptionDiagnoser
- implements ErrorDiagnoser
-{
-
- public boolean canDiagnose( Throwable error )
- {
- return DiagnosisUtils.containsInCausality( error, MojoExecutionException.class );
- }
-
- public String diagnose( Throwable error )
- {
- MojoExecutionException mee =
- (MojoExecutionException) DiagnosisUtils.getFromCausality( error, MojoExecutionException.class );
-
- StringBuffer message = new StringBuffer();
-
- Object source = mee.getSource();
- if ( source != null )
- {
- message.append( ": " ).append( mee.getSource() ).append( "\n" );
- }
-
- message.append( mee.getMessage() );
-
- String longMessage = mee.getLongMessage();
- if ( longMessage != null )
- {
- message.append( "\n\n" ).append( longMessage );
- }
-
- Throwable directCause = mee.getCause();
-
- if ( directCause != null )
- {
- message.append( "\n" );
-
- String directCauseMessage = directCause.getMessage();
-
- if ( directCauseMessage != null && mee.getMessage().indexOf( directCauseMessage ) < 0 )
- {
- message.append( "\nEmbedded error: " ).append( directCauseMessage );
- }
-
- DiagnosisUtils.appendRootCauseIfPresentAndUnique( directCause, message, false );
- }
-
- return message.toString();
- }
-
-}
diff --git a/maven-core/src/main/java/org/apache/maven/usability/MojoFailureExceptionDiagnoser.java b/maven-core/src/main/java/org/apache/maven/usability/MojoFailureExceptionDiagnoser.java
deleted file mode 100644
index 0a6f027bb3..0000000000
--- a/maven-core/src/main/java/org/apache/maven/usability/MojoFailureExceptionDiagnoser.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.apache.maven.usability;
-
-/*
- * 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 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, MojoFailureException.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" );
- }
-
- message.append( mfe.getMessage() );
-
- String longMessage = mfe.getLongMessage();
- if ( longMessage != null )
- {
- message.append( "\n\n" ).append( longMessage );
- }
-
- return message.toString();
- }
-
-}
diff --git a/maven-core/src/main/java/org/apache/maven/usability/PluginConfigurationDiagnoser.java b/maven-core/src/main/java/org/apache/maven/usability/PluginConfigurationDiagnoser.java
deleted file mode 100644
index fac56fe013..0000000000
--- a/maven-core/src/main/java/org/apache/maven/usability/PluginConfigurationDiagnoser.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.apache.maven.usability;
-
-/*
- * 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 org.apache.maven.plugin.PluginConfigurationException;
-import org.apache.maven.plugin.PluginParameterException;
-import org.apache.maven.usability.diagnostics.DiagnosisUtils;
-import org.apache.maven.usability.diagnostics.ErrorDiagnoser;
-import org.codehaus.plexus.component.configurator.ComponentConfigurationException;
-
-public class PluginConfigurationDiagnoser
- implements ErrorDiagnoser
-{
- public boolean canDiagnose( Throwable error )
- {
- return DiagnosisUtils.containsInCausality( error, PluginConfigurationException.class );
- }
-
- public String diagnose( Throwable error )
- {
- PluginConfigurationException pce =
- (PluginConfigurationException) DiagnosisUtils.getFromCausality( error, PluginConfigurationException.class );
-
- if ( pce instanceof PluginParameterException )
- {
- PluginParameterException exception = (PluginParameterException) pce;
-
- return exception.buildDiagnosticMessage();
- }
- else if ( DiagnosisUtils.containsInCausality( pce, ComponentConfigurationException.class ) )
- {
- ComponentConfigurationException cce = (ComponentConfigurationException) DiagnosisUtils.getFromCausality(
- pce, ComponentConfigurationException.class );
-
- return pce.buildConfigurationDiagnosticMessage( cce );
- }
- else
- {
- return pce.getMessage();
- }
- }
-}
diff --git a/maven-core/src/main/java/org/apache/maven/usability/ProfileActivationDiagnoser.java b/maven-core/src/main/java/org/apache/maven/usability/ProfileActivationDiagnoser.java
deleted file mode 100644
index fd336ebc36..0000000000
--- a/maven-core/src/main/java/org/apache/maven/usability/ProfileActivationDiagnoser.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.apache.maven.usability;
-
-/*
- * 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 org.apache.maven.profiles.activation.ProfileActivationException;
-import org.apache.maven.usability.diagnostics.DiagnosisUtils;
-import org.apache.maven.usability.diagnostics.ErrorDiagnoser;
-import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
-
-public class ProfileActivationDiagnoser
- implements ErrorDiagnoser
-{
-
- public boolean canDiagnose( Throwable error )
- {
- return DiagnosisUtils.containsInCausality( error, ProfileActivationException.class );
- }
-
- public String diagnose( Throwable error )
- {
- ProfileActivationException activationException =
- (ProfileActivationException) DiagnosisUtils.getFromCausality( error, ProfileActivationException.class );
-
- StringBuffer messageBuffer = new StringBuffer();
-
- messageBuffer.append( "Error activating profiles." );
- messageBuffer.append( "\n\nReason: " ).append( activationException.getMessage() );
-
- if ( DiagnosisUtils.containsInCausality( 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() );
- }
-
- messageBuffer.append( "\n" );
-
- return messageBuffer.toString();
- }
-
-}
diff --git a/maven-core/src/main/java/org/apache/maven/usability/ProjectBuildDiagnoser.java b/maven-core/src/main/java/org/apache/maven/usability/ProjectBuildDiagnoser.java
deleted file mode 100644
index 6aad4265a2..0000000000
--- a/maven-core/src/main/java/org/apache/maven/usability/ProjectBuildDiagnoser.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.apache.maven.usability;
-
-/*
- * 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 org.apache.maven.project.InvalidProjectModelException;
-import org.apache.maven.project.ProjectBuildingException;
-import org.apache.maven.project.validation.ModelValidationResult;
-import org.apache.maven.usability.diagnostics.DiagnosisUtils;
-import org.apache.maven.usability.diagnostics.ErrorDiagnoser;
-
-public class ProjectBuildDiagnoser
- implements ErrorDiagnoser
-{
-
- public boolean canDiagnose( Throwable error )
- {
- return DiagnosisUtils.containsInCausality( error, ProjectBuildingException.class );
- }
-
- public String diagnose( Throwable error )
- {
- ProjectBuildingException pbe =
- (ProjectBuildingException) DiagnosisUtils.getFromCausality( error, ProjectBuildingException.class );
-
- StringBuffer message = new StringBuffer();
-
- message.append( "Error building POM (may not be this project's POM)." ).append( "\n\n" );
-
- message.append( "\nProject ID: " ).append( pbe.getProjectId() );
-
- if ( pbe instanceof InvalidProjectModelException )
- {
- InvalidProjectModelException ipme = (InvalidProjectModelException) pbe;
-
- message.append( "\nPOM Location: " ).append( ipme.getPomLocation() );
-
- ModelValidationResult result = ipme.getValidationResult();
-
- if ( result != null )
- {
- message.append( "\nValidation Messages:\n\n" ).append( ipme.getValidationResult().render( " " ) );
- }
- }
-
- message.append( "\n\n" ).append( "Reason: " ).append( pbe.getMessage() );
-
- message.append( "\n\n" );
-
- return message.toString();
- }
-
-}
diff --git a/maven-core/src/main/java/org/apache/maven/usability/SystemWarnings.java b/maven-core/src/main/java/org/apache/maven/usability/SystemWarnings.java
deleted file mode 100644
index afd88d1ffa..0000000000
--- a/maven-core/src/main/java/org/apache/maven/usability/SystemWarnings.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.apache.maven.usability;/*
- * 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.
- */
-
-public class SystemWarnings
-{
-
- public static String getOfflineWarning()
- {
- return "\nNOTE: Maven is executing in offline mode. Any artifacts not already in your local\n" +
- "repository will be inaccessible.\n";
- }
-
-}
diff --git a/maven-core/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumentationException.java b/maven-core/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumentationException.java
deleted file mode 100644
index 99f8854dbf..0000000000
--- a/maven-core/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumentationException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.apache.maven.usability.plugin;/*
- * 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.
- */
-
-public class ExpressionDocumentationException
- extends Exception
-{
- static final long serialVersionUID = 1;
-
- public ExpressionDocumentationException( String message, Throwable cause )
- {
- super( message, cause );
- }
-
- public ExpressionDocumentationException( String message )
- {
- super( message );
- }
-
-}
diff --git a/maven-core/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java b/maven-core/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java
deleted file mode 100644
index df0a89271d..0000000000
--- a/maven-core/src/main/java/org/apache/maven/usability/plugin/ExpressionDocumenter.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package org.apache.maven.usability.plugin;
-
-/*
- * 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 org.apache.maven.usability.plugin.io.xpp3.ParamdocXpp3Reader;
-import org.codehaus.plexus.util.IOUtil;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-public class ExpressionDocumenter
-{
-
- private static final String[] EXPRESSION_ROOTS = { "project", "settings", "session", "plugin", "rootless" };
-
- private static final String EXPRESSION_DOCO_ROOTPATH = "META-INF/maven/plugin-expressions/";
-
- private static Map expressionDocumentation;
-
- public static Map load()
- throws ExpressionDocumentationException
- {
- if ( expressionDocumentation == null )
- {
- expressionDocumentation = new HashMap();
-
- ClassLoader docLoader = initializeDocLoader();
-
- for ( int i = 0; i < EXPRESSION_ROOTS.length; i++ )
- {
- InputStream docStream = null;
- try
- {
- docStream = docLoader
- .getResourceAsStream( EXPRESSION_DOCO_ROOTPATH + EXPRESSION_ROOTS[i] + ".paramdoc.xml" );
-
- if ( docStream != null )
- {
- Map doco = parseExpressionDocumentation( docStream );
-
- expressionDocumentation.putAll( doco );
- }
- }
- catch ( IOException e )
- {
- throw new ExpressionDocumentationException( "Failed to read documentation for expression root: " + EXPRESSION_ROOTS[i], e );
- }
- catch ( XmlPullParserException e )
- {
- throw new ExpressionDocumentationException( "Failed to parse documentation for expression root: " + EXPRESSION_ROOTS[i], e );
- }
- finally
- {
- IOUtil.close( docStream );
- }
- }
- }
-
- return expressionDocumentation;
- }
-
- /**
- *
- *
- * project.distributionManagementArtifactRepository
- *
- *
- * some-repo
- * scp://host/path
- *
- *
- * some-snap-repo
- * scp://host/snapshot-path
- *
- *
- * ]]>
- *
- *
- *
- * @throws IOException
- * @throws XmlPullParserException
- */
- private static Map parseExpressionDocumentation( InputStream docStream )
- throws IOException, XmlPullParserException
- {
- Reader reader = new BufferedReader( new InputStreamReader( docStream ) );
-
- ParamdocXpp3Reader paramdocReader = new ParamdocXpp3Reader();
-
- ExpressionDocumentation documentation = paramdocReader.read( reader, true );
-
- List expressions = documentation.getExpressions();
-
- Map bySyntax = new HashMap();
-
- if ( expressions != null && !expressions.isEmpty() )
- {
- for ( Iterator it = expressions.iterator(); it.hasNext(); )
- {
- Expression expr = (Expression) it.next();
-
- bySyntax.put( expr.getSyntax(), expr );
- }
- }
-
- return bySyntax;
- }
-
- private static ClassLoader initializeDocLoader()
- throws ExpressionDocumentationException
- {
- return ExpressionDocumenter.class.getClassLoader();
- }
-}
diff --git a/maven-core/src/main/resources/META-INF/plexus/components.xml b/maven-core/src/main/resources/META-INF/plexus/components.xml
index f72bcc61aa..40492030b0 100644
--- a/maven-core/src/main/resources/META-INF/plexus/components.xml
+++ b/maven-core/src/main/resources/META-INF/plexus/components.xml
@@ -144,9 +144,6 @@ under the License.
org.apache.maven.lifecycle.LifecycleExecutor
-
- org.apache.maven.usability.diagnostics.ErrorDiagnostics
-
org.apache.maven.execution.RuntimeInformation
diff --git a/maven-core/src/test/java/org/apache/maven/usability/InvalidArtifactDiagnoserTest.java b/maven-core/src/test/java/org/apache/maven/usability/InvalidArtifactDiagnoserTest.java
deleted file mode 100644
index 21325672b7..0000000000
--- a/maven-core/src/test/java/org/apache/maven/usability/InvalidArtifactDiagnoserTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package org.apache.maven.usability;
-
-/*
- * 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 org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.factory.ArtifactFactory;
-import org.codehaus.plexus.PlexusTestCase;
-
-public class InvalidArtifactDiagnoserTest
- extends PlexusTestCase
-{
- private InvalidArtifactDiagnoser diagnoser = new InvalidArtifactDiagnoser();
-
- public void testShouldDiagnoseArtifactWithMissingGroupId() throws Throwable
- {
- testDiagnosis( "Test diagnosis for missing groupId", null, "test-artifact", "1.0", "jar" );
- }
-
- public void testShouldDiagnoseArtifactWithMissingArtifactId() throws Throwable
- {
- testDiagnosis( "Test diagnosis for missing artifactId", "test.group.id", null, "1.0", "jar" );
- }
-
- public void testShouldDiagnoseArtifactWithMissingVersion() throws Throwable
- {
- testDiagnosis( "Test diagnosis for missing version", "test.group.id", "test-artifact", null, "jar" );
- }
-
- public void testShouldDiagnoseArtifactWithMissingType() throws Throwable
- {
- testDiagnosis( "Test diagnosis for missing type", "test.group.id", "test-artifact", "1.0", null );
- }
-
- public void testShouldDiagnoseArtifactWithMissingGroupIdAndArtifactId() throws Throwable
- {
- testDiagnosis( "Test diagnosis for missing groupId and artifactId", null, null, "1.0", "jar" );
- }
-
- private void testDiagnosis( String testHeader, String groupId, String artifactId, String version, String type )
- throws Throwable
- {
- System.out.println( "------------------------------------------------------------" );
- System.out.println( "| " + testHeader );
- System.out.println( "------------------------------------------------------------" );
- System.out.println();
-
- try
- {
- createArtifact( groupId, artifactId, version, type );
-
- fail( "artifact creation did not fail; nothing to diagnose." );
- }
- catch ( Throwable error )
- {
- assertTrue( "Unexpected error while constructing artifact: " + error, diagnoser.canDiagnose( error ) );
-
- if ( diagnoser.canDiagnose( error ) )
- {
- System.out.println( diagnoser.diagnose( error ) );
- }
- else
- {
- throw error;
- }
- }
- }
-
- private Artifact createArtifact( String groupId, String artifactId, String version, String type )
- throws Exception
- {
- ArtifactFactory artifactFactory = (ArtifactFactory) lookup( ArtifactFactory.ROLE );
- return artifactFactory.createBuildArtifact( groupId, artifactId, version, type );
- }
-
-}
diff --git a/maven-core/src/test/java/org/apache/maven/usability/PluginErrorDiagnoserTest.java b/maven-core/src/test/java/org/apache/maven/usability/PluginErrorDiagnoserTest.java
deleted file mode 100644
index 35a8225c5e..0000000000
--- a/maven-core/src/test/java/org/apache/maven/usability/PluginErrorDiagnoserTest.java
+++ /dev/null
@@ -1,280 +0,0 @@
-package org.apache.maven.usability;
-
-/*
- * 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 junit.framework.TestCase;
-import org.apache.maven.plugin.PluginConfigurationException;
-import org.apache.maven.plugin.PluginParameterException;
-import org.apache.maven.plugin.descriptor.DuplicateParameterException;
-import org.apache.maven.plugin.descriptor.MojoDescriptor;
-import org.apache.maven.plugin.descriptor.Parameter;
-import org.apache.maven.plugin.descriptor.PluginDescriptor;
-import org.codehaus.plexus.component.configurator.ComponentConfigurationException;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public class PluginErrorDiagnoserTest
- extends TestCase
-{
-
- private PluginConfigurationDiagnoser diagnoser = new PluginConfigurationDiagnoser();
-
- private PluginParameterException buildException( String prefix, String goal, List params )
- throws DuplicateParameterException
- {
- PluginDescriptor pluginDescriptor = new PluginDescriptor();
- pluginDescriptor.setArtifactId( "maven-test-plugin" );
- pluginDescriptor.setGroupId( "org.apache.maven.plugins" );
- pluginDescriptor.setVersion( "1.0" );
-
- pluginDescriptor.setGoalPrefix( prefix );
-
- MojoDescriptor mojoDescriptor = new MojoDescriptor();
- mojoDescriptor.setGoal( goal );
- mojoDescriptor.setPluginDescriptor( pluginDescriptor );
-
- mojoDescriptor.setParameters( params );
-
- return new PluginParameterException( mojoDescriptor, params );
- }
-
- public void testShouldDiagnoseInvalidPluginConfiguration()
- {
- printMethodHeader();
-
- ComponentConfigurationException cce = new ComponentConfigurationException(
- "Class \'org.apache.maven.plugin.jar.JarMojo\' does not contain a field named \'addClasspath\'" );
-
- PluginDescriptor pd = new PluginDescriptor();
- pd.setGroupId("testGroup");
- pd.setArtifactId("testArtifact");
-
- PluginConfigurationException pce = new PluginConfigurationException( pd, "test", cce );
-
- assertTrue( diagnoser.canDiagnose( pce ) );
-
- String userMessage = diagnoser.diagnose( pce );
-
- System.out.println( userMessage );
-
- assertNotNull( userMessage );
- }
-
- public void testShouldBeAbleToDiagnosePluginParameterExceptions()
- throws DuplicateParameterException
- {
- Parameter param = new Parameter();
- param.setName( "testName" );
- param.setAlias( "testAlias" );
- param.setExpression( "${project.build.finalName}" );
- param.setEditable( true );
-
- PluginParameterException error = buildException( "test", "test", Collections.singletonList( param ) );
-
- assertTrue( diagnoser.canDiagnose( error ) );
- }
-
- public void testParamWithOneReportsExpressionAndOneProjectBasedExpression()
- throws DuplicateParameterException
- {
- printMethodHeader();
-
- List params = new ArrayList();
-
- Parameter param = new Parameter();
-
- param.setName( "param1" );
-
- param.setExpression( "${reports}" );
-
- param.setEditable( false );
-
- params.add( param );
-
- Parameter param2 = new Parameter();
-
- param2.setName( "param2" );
-
- param2.setExpression( "${project.build.finalName}" );
-
- param2.setEditable( false );
-
- params.add( param2 );
-
- PluginParameterException error = buildException( "test", "test", params );
-
- String userMessage = diagnoser.diagnose( error );
-
- System.out.println( userMessage );
-
- assertNotNull( userMessage );
- }
-
- public void testParamWithNonActiveExpression()
- throws DuplicateParameterException
- {
- printMethodHeader();
-
- Parameter param = new Parameter();
- param.setName( "testName" );
- param.setAlias( "testAlias" );
- param.setExpression( "${project.build.finalName" );
- param.setEditable( true );
-
- PluginParameterException error = buildException( "test", "test", Collections.singletonList( param ) );
-
- String userMessage = diagnoser.diagnose( error );
-
- System.out.println( userMessage );
-
- assertNotNull( userMessage );
- }
-
- public void testParamWithoutExpression()
- throws DuplicateParameterException
- {
- printMethodHeader();
-
- Parameter param = new Parameter();
- param.setName( "testName" );
- param.setAlias( "testAlias" );
- param.setEditable( true );
-
- PluginParameterException error = buildException( "test", "test", Collections.singletonList( param ) );
-
- String userMessage = diagnoser.diagnose( error );
-
- System.out.println( userMessage );
-
- assertNotNull( userMessage );
- }
-
- public void testParamWithOneLocalRepositoryExpression()
- throws DuplicateParameterException
- {
- printMethodHeader();
-
- Parameter param = new Parameter();
- param.setName( "testName" );
- param.setAlias( "testAlias" );
- param.setExpression( "${localRepository}" );
- param.setEditable( false );
-
- PluginParameterException error = buildException( "test", "test", Collections.singletonList( param ) );
-
- String userMessage = diagnoser.diagnose( error );
-
- System.out.println( userMessage );
-
- assertNotNull( userMessage );
- }
-
- public void testParamWithOneSystemPropertyExpression()
- throws DuplicateParameterException
- {
- printMethodHeader();
-
- Parameter param = new Parameter();
- param.setName( "testName" );
- param.setAlias( "testAlias" );
- param.setExpression( "${maven.mode.online}" );
- param.setEditable( false );
-
- PluginParameterException error = buildException( "test", "test", Collections.singletonList( param ) );
-
- String userMessage = diagnoser.diagnose( error );
-
- System.out.println( userMessage );
-
- assertNotNull( userMessage );
- }
-
- public void testParamWithOneProjectBasedExpression()
- throws DuplicateParameterException
- {
- printMethodHeader();
-
- Parameter param = new Parameter();
- param.setName( "testName" );
- param.setAlias( "testAlias" );
- param.setExpression( "${project.build.finalName}" );
- param.setEditable( true );
-
- PluginParameterException error = buildException( "test", "test", Collections.singletonList( param ) );
-
- String userMessage = diagnoser.diagnose( error );
-
- System.out.println( userMessage );
-
- assertNotNull( userMessage );
- }
-
- public void testParamWithOneProjectAPIBasedExpression()
- throws DuplicateParameterException
- {
- printMethodHeader();
-
- Parameter param = new Parameter();
- param.setName( "testName" );
- param.setExpression( "${project.distributionManagementArtifactRepository}" );
- param.setRequired( true );
- param.setEditable( false );
-
- PluginParameterException error = buildException( "test", "test", Collections.singletonList( param ) );
-
- String userMessage = diagnoser.diagnose( error );
-
- System.out.println( userMessage );
-
- assertNotNull( userMessage );
- }
-
- public void testNonEditableParamWithOneProjectBasedExpression()
- throws DuplicateParameterException
- {
- printMethodHeader();
-
- Parameter param = new Parameter();
- param.setName( "testName" );
- param.setAlias( "testAlias" );
- param.setExpression( "${project.build.finalName}" );
- param.setEditable( false );
-
- PluginParameterException error = buildException( "test", "test", Collections.singletonList( param ) );
-
- String userMessage = diagnoser.diagnose( error );
-
- System.out.println( userMessage );
-
- assertNotNull( userMessage );
- }
-
- private void printMethodHeader()
- {
- IllegalArgumentException marker = new IllegalArgumentException();
-
- System.out.println( "---------------------------------------------------------------------\n"
- + "Visual output for " + marker.getStackTrace()[1].getMethodName()
- + ":\n---------------------------------------------------------------------" );
- }
-
-}
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
index 0ef16e1c20..0629d9dd32 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
@@ -35,9 +35,9 @@ import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionResult;
import org.apache.maven.execution.ReactorManager;
+import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
import org.codehaus.plexus.classworlds.ClassWorld;
-import org.codehaus.plexus.logging.Logger;
import java.io.File;
import java.io.IOException;
@@ -422,16 +422,12 @@ public class MavenCli
if ( result.hasExceptions() )
{
- showError( (Exception) result.getExceptions().get( 0 ), showErrors );
-
- logger.close();
-
return 1;
}
-
- logger.close();
-
- return 0;
+ else
+ {
+ return 0;
+ }
}
private static void showVersion()
@@ -547,7 +543,6 @@ public class MavenCli
{
ReactorManager reactorManager = result.getReactorManager();
- // TODO: should all the logging be left to the CLI?
logReactorSummary( reactorManager );
if ( reactorManager != null && reactorManager.hasBuildFailures() )
@@ -572,11 +567,29 @@ public class MavenCli
}
}
- logSuccess( reactorManager );
+ if ( result.hasExceptions() )
+ {
+ for ( Iterator i = result.getExceptions().iterator(); i.hasNext(); )
+ {
+ Exception e = (Exception) i.next();
- stats( request.getStartTime() );
+ showError( e.getMessage(), e, request.isShowErrors() );
+ }
+ }
+ else
+ {
+ line();
- line();
+ getLogger().info( "BUILD SUCCESSFUL" );
+
+ line();
+
+ stats( request.getStartTime() );
+
+ line();
+ }
+
+ logger.close();
}
private void logErrors( ReactorManager rm,
@@ -594,10 +607,6 @@ public class MavenCli
"Error for project: " + project.getName() + " (during " + buildFailure.getTask() + ")" );
line();
-
- logTrace(
- buildFailure.getCause(),
- showErrors );
}
}
@@ -609,12 +618,6 @@ public class MavenCli
}
}
- private static void showError( Exception e,
- boolean show )
- {
- showError( e.getMessage(), e, show );
- }
-
private static void showError( String message,
Exception e,
boolean show )
@@ -634,36 +637,6 @@ public class MavenCli
System.err.println( "For more information, run with the -e flag" );
}
}
-
- private void logTrace( Throwable t,
- boolean showErrors )
- {
- if ( getLogger().isDebugEnabled() )
- {
- getLogger().debug(
- "Trace",
- t );
-
- line();
- }
- else if ( showErrors )
- {
- getLogger().info(
- "Trace",
- t );
-
- line();
- }
- }
-
- private void logSuccess( ReactorManager rm )
- {
- line();
-
- getLogger().info( "BUILD SUCCESSFUL" );
-
- line();
- }
private void logReactorSummary( ReactorManager rm )
{
diff --git a/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java b/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java
index f31fa0b1d9..98e0d3ac9f 100644
--- a/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java
+++ b/maven-embedder/src/main/java/org/apache/maven/embedder/execution/DefaultMavenExecutionRequestPopulator.java
@@ -36,7 +36,6 @@ import org.apache.maven.settings.Mirror;
import org.apache.maven.settings.Proxy;
import org.apache.maven.settings.Server;
import org.apache.maven.settings.Settings;
-import org.apache.maven.usability.SystemWarnings;
import org.apache.maven.wagon.repository.RepositoryPermissions;
import org.codehaus.plexus.PlexusConstants;
import org.codehaus.plexus.PlexusContainer;
@@ -125,7 +124,7 @@ public class DefaultMavenExecutionRequestPopulator
if ( request.isOffline() )
{
- getLogger().info( SystemWarnings.getOfflineWarning() );
+ getLogger().info( "You are working in offline mode." );
wagonManager.setOnline( false );
}
diff --git a/maven-error-diagnostics/pom.xml b/maven-error-diagnostics/pom.xml
deleted file mode 100644
index 3068268847..0000000000
--- a/maven-error-diagnostics/pom.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-
-
-
-
-
-
- maven
- org.apache.maven
- 2.1-SNAPSHOT
-
- 4.0.0
- maven-error-diagnostics
- Maven Error Diagnostics
- Provides a manager component which will process a given Throwable instance through a set of diagnostic
- sub-components, and return a String message with user-friendly information about the error and possibly
- how to fix it.
-
-
- org.codehaus.plexus
- plexus-container-default
-
-
-
diff --git a/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/DiagnosisUtils.java b/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/DiagnosisUtils.java
deleted file mode 100644
index bc70412d4a..0000000000
--- a/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/DiagnosisUtils.java
+++ /dev/null
@@ -1,108 +0,0 @@
-package org.apache.maven.usability.diagnostics;
-
-/*
- * 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.
- */
-
-public final class DiagnosisUtils
-{
- private DiagnosisUtils()
- {
- }
-
- public static boolean containsInCausality( Throwable error, Class test )
- {
- Throwable cause = error;
-
- while ( cause != null )
- {
- if ( test.isInstance( cause ) )
- {
- return true;
- }
-
- cause = cause.getCause();
- }
-
- return false;
- }
-
- public static Throwable getRootCause( Throwable error )
- {
- Throwable cause = error;
-
- while ( true )
- {
- Throwable nextCause = cause.getCause();
-
- if ( nextCause == null )
- {
- break;
- }
- else
- {
- cause = nextCause;
- }
- }
-
- return cause;
- }
-
- public static Throwable getFromCausality( Throwable error, Class targetClass )
- {
- Throwable cause = error;
-
- while ( cause != null )
- {
- if ( targetClass.isInstance( cause ) )
- {
- return cause;
- }
-
- cause = cause.getCause();
- }
-
- return null;
- }
-
- public static void appendRootCauseIfPresentAndUnique( Throwable error, StringBuffer message,
- boolean includeTypeInfo )
- {
- if ( error == null )
- {
- return;
- }
-
- Throwable root = getRootCause( error );
-
- if ( root != null && !root.equals( error ) )
- {
- String rootMsg = root.getMessage();
-
- if ( rootMsg != null && ( error.getMessage() == null || error.getMessage().indexOf( rootMsg ) < 0 ) )
- {
- message.append( "\n" ).append( rootMsg );
-
- if ( includeTypeInfo )
- {
- message.append( "\nRoot error type: " ).append( root.getClass().getName() );
- }
- }
- }
- }
-}
diff --git a/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/ErrorDiagnoser.java b/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/ErrorDiagnoser.java
deleted file mode 100644
index de6796f927..0000000000
--- a/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/ErrorDiagnoser.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.apache.maven.usability.diagnostics;
-
-/*
- * 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.
- */
-
-public interface ErrorDiagnoser
-{
- public static final String ROLE = ErrorDiagnoser.class.getName();
-
- public boolean canDiagnose( Throwable error );
-
- public String diagnose( Throwable error );
-
-}
diff --git a/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/ErrorDiagnostics.java b/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/ErrorDiagnostics.java
deleted file mode 100644
index a7ea44fb3b..0000000000
--- a/maven-error-diagnostics/src/main/java/org/apache/maven/usability/diagnostics/ErrorDiagnostics.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.apache.maven.usability.diagnostics;
-
-/*
- * 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 org.codehaus.plexus.PlexusConstants;
-import org.codehaus.plexus.PlexusContainer;
-import org.codehaus.plexus.component.repository.exception.ComponentLifecycleException;
-import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
-import org.codehaus.plexus.context.Context;
-import org.codehaus.plexus.context.ContextException;
-import org.codehaus.plexus.logging.AbstractLogEnabled;
-import org.codehaus.plexus.personality.plexus.lifecycle.phase.Contextualizable;
-
-import java.util.Iterator;
-import java.util.List;
-
-public class ErrorDiagnostics
- extends AbstractLogEnabled
- implements Contextualizable
-{
- public static final String ROLE = ErrorDiagnostics.class.getName();
-
- private PlexusContainer container;
-
- private List errorDiagnosers;
-
- public void setErrorDiagnosers( List errorDiagnosers )
- {
- this.errorDiagnosers = errorDiagnosers;
- }
-
- public String diagnose( Throwable error )
- {
- List diags = errorDiagnosers;
-
- boolean releaseDiags = false;
- boolean errorProcessed = false;
-
- String message = null;
-
- try
- {
- if ( diags == null )
- {
- releaseDiags = true;
-
- try
- {
- diags = container.lookupList( ErrorDiagnoser.ROLE );
- }
- catch ( ComponentLookupException e )
- {
- getLogger().error( "Failed to lookup the list of error diagnosers.", e );
- }
- }
-
- if ( diags != null )
- {
- for ( Iterator it = diags.iterator(); it.hasNext(); )
- {
- ErrorDiagnoser diagnoser = (ErrorDiagnoser) it.next();
-
- if ( diagnoser.canDiagnose( error ) )
- {
- errorProcessed = true;
-
- message = diagnoser.diagnose( error );
-
- break;
- }
- }
- }
- }
- finally
- {
- if ( releaseDiags && diags != null )
- {
- try
- {
- container.releaseAll( diags );
- }
- catch ( ComponentLifecycleException e )
- {
- getLogger().debug( "Failed to release error diagnoser list.", e );
- }
- }
-
- if ( !errorProcessed )
- {
- message = new PuntErrorDiagnoser().diagnose( error );
- }
- }
-
- return message;
- }
-
- public void contextualize( Context context )
- throws ContextException
- {
- this.container = (PlexusContainer) context.get( PlexusConstants.PLEXUS_KEY );
- }
-
- private static class PuntErrorDiagnoser
- implements ErrorDiagnoser
- {
-
- public boolean canDiagnose( Throwable error )
- {
- return true;
- }
-
- public String diagnose( Throwable error )
- {
- StringBuffer message = new StringBuffer();
-
- message.append( error.getMessage() );
-
- DiagnosisUtils.appendRootCauseIfPresentAndUnique( error, message, false );
-
- return message.toString();
- }
-
- }
-}
diff --git a/maven-error-diagnostics/src/main/resources/META-INF/plexus/components.xml b/maven-error-diagnostics/src/main/resources/META-INF/plexus/components.xml
deleted file mode 100644
index 8ca03e41e6..0000000000
--- a/maven-error-diagnostics/src/main/resources/META-INF/plexus/components.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
- org.apache.maven.usability.diagnostics.ErrorDiagnostics
- org.apache.maven.usability.diagnostics.ErrorDiagnostics
-
-
-
diff --git a/maven-monitor/pom.xml b/maven-monitor/pom.xml
deleted file mode 100644
index 163256757f..0000000000
--- a/maven-monitor/pom.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
- maven
- org.apache.maven
- 2.1-SNAPSHOT
-
- 4.0.0
- maven-monitor
- Maven Monitor
-
diff --git a/pom.xml b/pom.xml
index 72c79c0637..22b02ca052 100644
--- a/pom.xml
+++ b/pom.xml
@@ -112,10 +112,8 @@ under the License.
maven-build-context
maven-core
- maven-error-diagnostics
maven-lifecycle
maven-model
- maven-monitor
maven-plugin-api
maven-plugin-descriptor
maven-plugin-parameter-documenter