getLifecyclePhases();
+ List getLifecyclePhases();
}
\ No newline at end of file
diff --git a/maven-core/src/main/java/org/apache/maven/ProjectBuildFailureException.java b/maven-core/src/main/java/org/apache/maven/ProjectBuildFailureException.java
index 07eeb2a6cd..1e9509842b 100644
--- a/maven-core/src/main/java/org/apache/maven/ProjectBuildFailureException.java
+++ b/maven-core/src/main/java/org/apache/maven/ProjectBuildFailureException.java
@@ -1,7 +1,5 @@
package org.apache.maven;
-import org.apache.maven.lifecycle.MojoBindingUtils;
-import org.apache.maven.lifecycle.model.MojoBinding;
import org.apache.maven.plugin.MojoFailureException;
/**
@@ -19,17 +17,12 @@ public class ProjectBuildFailureException
{
private final String projectId;
- private final MojoBinding binding;
- public ProjectBuildFailureException( String projectId,
- MojoBinding binding,
- MojoFailureException cause )
+ public ProjectBuildFailureException( String projectId, MojoFailureException cause )
{
- super( "Build for project: " + projectId + " failed during execution of mojo: "
- + MojoBindingUtils.toString( binding ), cause );
+ super( "Build for project: " + projectId + " failed during execution of mojo.", cause );
this.projectId = projectId;
- this.binding = binding;
}
public MojoFailureException getMojoFailureException()
@@ -41,10 +34,4 @@ public class ProjectBuildFailureException
{
return projectId;
}
-
- public MojoBinding getBinding()
- {
- return binding;
- }
-
}
diff --git a/maven-core/src/main/java/org/apache/maven/errors/CoreErrorReporter.java b/maven-core/src/main/java/org/apache/maven/errors/CoreErrorReporter.java
deleted file mode 100644
index e2075f03f8..0000000000
--- a/maven-core/src/main/java/org/apache/maven/errors/CoreErrorReporter.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package org.apache.maven.errors;
-
-import org.apache.maven.NoGoalsSpecifiedException;
-import org.apache.maven.ProjectCycleException;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
-import org.apache.maven.artifact.resolver.AbstractArtifactResolutionException;
-import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
-import org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException;
-import org.apache.maven.artifact.versioning.ArtifactVersion;
-import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
-import org.apache.maven.execution.MavenExecutionRequest;
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.lifecycle.LifecycleException;
-import org.apache.maven.lifecycle.LifecycleLoaderException;
-import org.apache.maven.lifecycle.LifecycleSpecificationException;
-import org.apache.maven.lifecycle.model.MojoBinding;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Plugin;
-import org.apache.maven.plugin.InvalidPluginException;
-import org.apache.maven.plugin.MojoExecution;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.PluginConfigurationException;
-import org.apache.maven.plugin.PluginExecutionException;
-import org.apache.maven.plugin.PluginLoaderException;
-import org.apache.maven.plugin.PluginManagerException;
-import org.apache.maven.plugin.PluginParameterException;
-import org.apache.maven.plugin.PluginVersionNotFoundException;
-import org.apache.maven.plugin.PluginVersionResolutionException;
-import org.apache.maven.plugin.descriptor.Parameter;
-import org.apache.maven.project.DuplicateArtifactAttachmentException;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.ProjectBuildingException;
-import org.apache.maven.project.artifact.InvalidDependencyVersionException;
-import org.apache.maven.project.path.PathTranslator;
-import org.apache.maven.reactor.MavenExecutionException;
-import org.apache.maven.reactor.MissingModuleException;
-import org.apache.maven.realm.RealmManagementException;
-import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
-import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
-import org.codehaus.plexus.configuration.PlexusConfiguration;
-import org.codehaus.plexus.logging.Logger;
-
-import java.util.List;
-
-public interface CoreErrorReporter
- extends ProjectErrorReporter
-{
-
- void handleSuperPomBuildingError( ProjectBuildingException exception );
-
- void reportAggregatedMojoFailureException( MavenSession session, MojoBinding binding, MojoFailureException cause );
-
- void reportAttemptToOverrideUneditableMojoParameter( Parameter currentParameter, MojoBinding binding, MavenProject project, MavenSession session, MojoExecution exec, PathTranslator translator, Logger logger, PluginConfigurationException cause );
-
- void reportErrorApplyingMojoConfiguration( MojoBinding binding, MavenProject project, PlexusConfiguration config, PluginConfigurationException cause );
-
- void reportErrorConfiguringExtensionPluginRealm( Plugin plugin, Model originModel, List remoteRepos, MavenExecutionRequest request, PluginManagerException cause );
-
- void reportErrorConfiguringExtensionPluginRealm( Plugin plugin, Model originModel, List remoteRepos, MavenExecutionRequest request, RealmManagementException cause );
-
- void reportErrorFormulatingBuildPlan( List tasks, MavenProject project, MavenSession session, LifecycleException cause );
-
- void reportErrorLoadingPlugin( MojoBinding binding, MavenProject project, PluginLoaderException cause );
-
- void reportErrorManagingRealmForExtension( Artifact extensionArtifact, Artifact projectArtifact, List remoteRepos, MavenExecutionRequest request, RealmManagementException cause );
-
- void reportErrorResolvingExtensionDirectDependencies( Artifact extensionArtifact, Artifact projectArtifact, List remoteRepos, MavenExecutionRequest request, ArtifactMetadataRetrievalException cause );
-
- void reportErrorSearchingforCompatibleExtensionPluginVersion( Plugin plugin, Model originModel, List remoteRepos, MavenExecutionRequest request, String requiredMavenVersion, String currentMavenVersion, InvalidVersionSpecificationException cause );
-
- void reportErrorSearchingforCompatibleExtensionPluginVersion( Plugin plugin, Model originModel, List remoteRepos, MavenExecutionRequest request, String requiredMavenVersion, String currentMavenVersion, ArtifactMetadataRetrievalException cause );
-
- void reportExtensionPluginArtifactNotFound( Plugin plugin, Model originModel, List remoteRepos, MavenExecutionRequest request, AbstractArtifactResolutionException cause );
-
- void reportExtensionPluginVersionNotFound( Plugin plugin, Model originModel, List remoteRepos, MavenExecutionRequest request, PluginVersionNotFoundException cause );
-
- void reportIncompatibleMavenVersionForExtensionPlugin( Plugin plugin, Model originModel, List remoteRepos, MavenExecutionRequest request, String requiredMavenVersion, String currentMavenVersion, PluginVersionResolutionException err );
-
- void reportInvalidDependencyVersionInExtensionPluginPOM( Plugin plugin, Model originModel, List remoteRepos, MavenExecutionRequest request, InvalidDependencyVersionException cause );
-
- void reportInvalidMavenVersion( MavenProject project, ArtifactVersion mavenVersion, MavenExecutionException err );
-
- void reportInvalidPluginExecutionEnvironment( MojoBinding binding, MavenProject project, PluginExecutionException cause );
-
- void reportLifecycleLoaderErrorWhileValidatingTask( String task, MavenSession session, MavenProject rootProject, LifecycleLoaderException cause );
-
- void reportLifecycleSpecErrorWhileValidatingTask( String task, MavenSession session, MavenProject rootProject, LifecycleSpecificationException cause );
-
- void reportMissingRequiredMojoParameter( MojoBinding binding, MavenProject project, List invalidParameters, PluginParameterException err );
-
- void reportMojoExecutionException( MojoBinding binding, MavenProject project, MojoExecutionException cause );
-
- void reportMojoLookupError( MojoBinding binding, MavenProject project, ComponentLookupException cause );
-
- void reportNoGoalsSpecifiedException( MavenProject rootProject, NoGoalsSpecifiedException error );
-
- void reportProjectCycle( ProjectCycleException error );
-
- void reportProjectDependenciesNotFound( MavenProject project, String scope, ArtifactNotFoundException cause );
-
- void reportProjectDependenciesNotFound( MavenProject project, String scope, MultipleArtifactsNotFoundException cause );
-
- void reportProjectDependenciesUnresolvable( MavenProject project, String scope, ArtifactResolutionException cause );
-
- void reportProjectMojoFailureException( MavenSession session, MojoBinding binding, MojoFailureException cause );
-
- void reportReflectionErrorWhileEvaluatingMojoParameter( Parameter currentParameter, MojoBinding binding, MavenProject project, String expression, Exception cause );
-
- void reportUnresolvableArtifactWhileAddingExtensionPlugin( Plugin plugin, Model originModel, List remoteRepos, MavenExecutionRequest request, ArtifactResolutionException cause );
-
- void reportUnresolvableExtensionPluginPOM( Plugin plugin, Model originModel, List remoteRepos, MavenExecutionRequest request, ArtifactMetadataRetrievalException cause );
-
- void reportUseOfBannedMojoParameter( Parameter currentParameter, MojoBinding binding, MavenProject project, String expression, String altExpression, ExpressionEvaluationException err );
-
- void reportMissingModulePom( MissingModuleException err );
-
- void reportInvalidPluginForDirectInvocation( String task, MavenSession session, MavenProject project, InvalidPluginException err );
-
- void reportDuplicateAttachmentException( MojoBinding binding, MavenProject project, DuplicateArtifactAttachmentException cause );
-
-}
diff --git a/maven-core/src/main/java/org/apache/maven/errors/CoreErrorTips.java b/maven-core/src/main/java/org/apache/maven/errors/CoreErrorTips.java
deleted file mode 100644
index 8506549164..0000000000
--- a/maven-core/src/main/java/org/apache/maven/errors/CoreErrorTips.java
+++ /dev/null
@@ -1,323 +0,0 @@
-package org.apache.maven.errors;
-
-import org.apache.maven.ProjectCycleException;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
-import org.apache.maven.artifact.resolver.AbstractArtifactResolutionException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionResult;
-import org.apache.maven.artifact.versioning.ArtifactVersion;
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.lifecycle.LifecycleException;
-import org.apache.maven.lifecycle.model.MojoBinding;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Plugin;
-import org.apache.maven.plugin.InvalidPluginException;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.PluginConfigurationException;
-import org.apache.maven.plugin.PluginExecutionException;
-import org.apache.maven.plugin.PluginLoaderException;
-import org.apache.maven.plugin.PluginManagerException;
-import org.apache.maven.plugin.PluginVersionNotFoundException;
-import org.apache.maven.plugin.PluginVersionResolutionException;
-import org.apache.maven.plugin.descriptor.Parameter;
-import org.apache.maven.project.DuplicateArtifactAttachmentException;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.artifact.InvalidDependencyVersionException;
-import org.apache.maven.realm.RealmManagementException;
-import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
-import org.codehaus.plexus.configuration.PlexusConfiguration;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.List;
-
-// NOTE: The strange String[] syntax is a backward adaptation from java5 stuff, where
-// I was using varargs in listOf(..). I'm not moving them to constants because I'd like
-// to go back to this someday...
-
-// TODO: Fill these out!!
-public final class CoreErrorTips
-{
-
- private static final List NO_GOALS_TIPS = Arrays.asList( new String[] {
- "Introduction to the Build Lifecycle", "\t(http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html)",
- "Maven in 5 Minutes guide (http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html)",
- "Maven User's documentation (http://maven.apache.org/users/)",
- "Maven Plugins page (http://maven.apache.org/plugins/)",
- "CodeHaus Mojos Project page (http://mojo.codehaus.org/plugins.html)"
- } );
-
- private CoreErrorTips()
- {
- }
-
- public static List getNoGoalsTips()
- {
- return NO_GOALS_TIPS;
- }
-
- public static List getMojoFailureTips( MojoBinding binding )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getProjectCycleTips( ProjectCycleException error )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getTaskValidationTips( String task, Exception cause )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getMissingPluginDescriptorTips( MojoBinding binding,
- MavenProject project )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getInvalidExecutionEnvironmentTips( MojoBinding binding,
- MavenProject project,
- PluginExecutionException cause )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getMojoExecutionExceptionTips( MojoBinding binding,
- MavenProject project,
- MojoExecutionException cause )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getMojoLookupErrorTips( MojoBinding binding,
- MavenProject project,
- ComponentLookupException cause )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getUneditableMojoParameterTips( Parameter currentParameter,
- MojoBinding binding,
- MavenProject project,
- PluginConfigurationException cause )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getBannedParameterExpressionTips( Parameter currentParameter,
- MojoBinding binding,
- MavenProject project )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getReflectionErrorInParameterExpressionTips( String expression,
- Parameter currentParameter,
- MojoBinding binding,
- MavenProject project )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getMissingRequiredParameterTips( List invalidParameters,
- MojoBinding binding,
- MavenProject project )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getMojoConfigurationErrorTips( MojoBinding binding,
- MavenProject project,
- PlexusConfiguration config,
- PluginConfigurationException cause )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getBuildPlanningErrorTips( List tasks,
- MavenProject configuringProject,
- LifecycleException cause )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getErrorLoadingPluginTips( MojoBinding binding,
- MavenProject project,
- PluginLoaderException cause )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getDependencyArtifactResolutionTips( MavenProject project,
- Artifact depArtifact,
- AbstractArtifactResolutionException cause )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getDependencyArtifactResolutionTips( MavenProject project,
- String scope,
- AbstractArtifactResolutionException cause )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
-
- public static List getIncompatibleProjectMavenVersionPrereqTips( MavenProject project,
- ArtifactVersion mavenVersion )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getPomFileScanningErrorTips( File basedir,
- String includes,
- String excludes )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getErrorResolvingExtensionDirectDepsTips( Artifact extensionArtifact,
- Artifact projectArtifact,
- ArtifactMetadataRetrievalException cause )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getErrorResolvingExtensionArtifactsTips( Artifact extensionArtifact,
- Artifact projectArtifact,
- ArtifactResolutionResult resolutionResult )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getErrorManagingExtensionRealmTips( Artifact extensionArtifact,
- Artifact projectArtifact,
- RealmManagementException cause )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getErrorManagingExtensionPluginRealmTips( Plugin plugin,
- Model originModel,
- RealmManagementException cause )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getErrorResolvingExtensionPluginArtifactsTips( Plugin plugin,
- Model originModel,
- AbstractArtifactResolutionException cause )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getErrorResolvingExtensionPluginVersionTips( Plugin plugin,
- Model originModel,
- PluginVersionResolutionException cause )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getInvalidDependencyVersionForExtensionPluginTips( Plugin plugin,
- Model originModel,
- InvalidDependencyVersionException cause )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getInvalidPluginVersionRangeForExtensionPluginTips( Plugin plugin,
- Model originModel,
- String requiredMavenVersion,
- String currentMavenVersion )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getInvalidPluginVersionRangeForExtensionPluginTips( Plugin plugin,
- Model originModel,
- String requiredMavenVersion,
- String currentMavenVersion,
- Exception cause )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getUnresolvableExtensionPluginPOMTips( Plugin plugin,
- Model originModel,
- ArtifactMetadataRetrievalException cause )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getExtensionPluginVersionNotFoundTips( Plugin plugin,
- Model originModel,
- PluginVersionNotFoundException cause )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getErrorManagingExtensionPluginRealmTips( Plugin plugin,
- Model originModel,
- PluginManagerException cause )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getMissingModuleTips( File pomFile,
- File moduleFile,
- String moduleName )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getInvalidPluginForDirectInvocationTips( String task,
- MavenSession session,
- MavenProject project,
- InvalidPluginException err )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getDuplicateAttachmentTips( MojoBinding binding,
- MavenProject project,
- DuplicateArtifactAttachmentException cause )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/maven-core/src/main/java/org/apache/maven/errors/CoreReporterManager.java b/maven-core/src/main/java/org/apache/maven/errors/CoreReporterManager.java
deleted file mode 100644
index 523c9964e6..0000000000
--- a/maven-core/src/main/java/org/apache/maven/errors/CoreReporterManager.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.apache.maven.errors;
-
-import org.apache.maven.errors.ProjectReporterManager;
-
-public final class CoreReporterManager
-{
-
- // FIXME: This is not threadsafe!!
- private static CoreErrorReporter reporter;
-
- private CoreReporterManager()
- {
- }
-
- public static CoreErrorReporter getReporter()
- {
- if ( reporter == null )
- {
- reporter = new DefaultCoreErrorReporter();
- // FIXME: Is this correct? What might this isolate and make inaccessible in a running system?
- ProjectReporterManager.setReporter( reporter );
- }
-
- return reporter;
- }
-
- public static void setReporter( CoreErrorReporter instance )
- {
- reporter = instance;
- ProjectReporterManager.setReporter( instance );
- }
-
- public static void clearReporter()
- {
- reporter = null;
- }
-
-}
diff --git a/maven-core/src/main/java/org/apache/maven/errors/DefaultCoreErrorReporter.java b/maven-core/src/main/java/org/apache/maven/errors/DefaultCoreErrorReporter.java
deleted file mode 100644
index 5364925fbc..0000000000
--- a/maven-core/src/main/java/org/apache/maven/errors/DefaultCoreErrorReporter.java
+++ /dev/null
@@ -1,1589 +0,0 @@
-package org.apache.maven.errors;
-
-import org.apache.maven.NoGoalsSpecifiedException;
-import org.apache.maven.ProjectCycleException;
-import org.apache.maven.project.path.PathTranslator;
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.artifact.ArtifactUtils;
-import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
-import org.apache.maven.artifact.resolver.AbstractArtifactResolutionException;
-import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
-import org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException;
-import org.apache.maven.artifact.versioning.ArtifactVersion;
-import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
-import org.apache.maven.execution.MavenExecutionRequest;
-import org.apache.maven.execution.MavenSession;
-import org.apache.maven.lifecycle.LifecycleException;
-import org.apache.maven.lifecycle.LifecycleLoaderException;
-import org.apache.maven.lifecycle.LifecycleSpecificationException;
-import org.apache.maven.lifecycle.MojoBindingUtils;
-import org.apache.maven.lifecycle.model.MojoBinding;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Plugin;
-import org.apache.maven.plugin.InvalidPluginException;
-import org.apache.maven.plugin.MojoExecution;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.plugin.PluginConfigurationException;
-import org.apache.maven.plugin.PluginExecutionException;
-import org.apache.maven.plugin.PluginLoaderException;
-import org.apache.maven.plugin.PluginManagerException;
-import org.apache.maven.plugin.PluginParameterException;
-import org.apache.maven.plugin.PluginParameterExpressionEvaluator;
-import org.apache.maven.plugin.PluginVersionNotFoundException;
-import org.apache.maven.plugin.PluginVersionResolutionException;
-import org.apache.maven.plugin.descriptor.Parameter;
-import org.apache.maven.project.DuplicateArtifactAttachmentException;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.ProjectBuildingException;
-import org.apache.maven.project.artifact.InvalidDependencyVersionException;
-import org.apache.maven.reactor.MavenExecutionException;
-import org.apache.maven.reactor.MissingModuleException;
-import org.apache.maven.realm.RealmManagementException;
-import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluationException;
-import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
-import org.codehaus.plexus.configuration.PlexusConfiguration;
-import org.codehaus.plexus.configuration.PlexusConfigurationException;
-import org.codehaus.plexus.logging.Logger;
-import org.codehaus.plexus.util.dag.CycleDetectedException;
-
-import java.io.File;
-import java.io.StringWriter;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-public class DefaultCoreErrorReporter
- extends DefaultProjectErrorReporter
- implements CoreErrorReporter
-{
-
- private static final String NEWLINE = "\n";
-
- public DefaultCoreErrorReporter( Map formattedMessageStore, Map realCauseStore, Map stackTraceRecommendationStore )
- {
- super( formattedMessageStore, realCauseStore, stackTraceRecommendationStore );
- }
-
- public DefaultCoreErrorReporter()
- {
-
- }
-
- public void reportNoGoalsSpecifiedException( MavenProject rootProject, NoGoalsSpecifiedException error )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "You must specify at least one goal or lifecycle phase to perform build steps." );
- writer.write( NEWLINE );
- writer.write( "The following list illustrates some commonly used build commands:" );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( " mvn clean" );
- writer.write( NEWLINE );
- writer.write( " Deletes any build output (e.g. class files or JARs)." );
- writer.write( NEWLINE );
- writer.write( " mvn test" );
- writer.write( NEWLINE );
- writer.write( " Runs the unit tests for the project." );
- writer.write( NEWLINE );
- writer.write( " mvn install" );
- writer.write( NEWLINE );
- writer.write( " Copies the project artifacts into your local repository." );
- writer.write( NEWLINE );
- writer.write( " mvn deploy" );
- writer.write( NEWLINE );
- writer.write( " Copies the project artifacts into the remote repository." );
- writer.write( NEWLINE );
- writer.write( " mvn site" );
- writer.write( NEWLINE );
- writer.write( " Creates project documentation (e.g. reports or Javadoc)." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- addTips( CoreErrorTips.getNoGoalsTips(), writer );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Use \"mvn --help\" to show general usage information about Maven's command line." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- registerBuildError( error, writer.toString() );
- }
-
- private void addTips( List tips,
- StringWriter writer )
- {
- if ( ( tips != null ) && !tips.isEmpty() )
- {
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Please see:" );
- writer.write( NEWLINE );
- for ( Iterator it = tips.iterator(); it.hasNext(); )
- {
- String tip = (String) it.next();
-
- writer.write( NEWLINE );
- writer.write( "\t- " );
- writer.write( tip );
- }
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "for more information." );
- }
- }
-
- public void reportAggregatedMojoFailureException( MavenSession session,
- MojoBinding binding,
- MojoFailureException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Mojo (aggregator): " );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( " " );
- writer.write( MojoBindingUtils.toString( binding ) );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "FAILED while executing in directory:" );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( " " );
- writer.write( session.getExecutionRootDirectory() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Reason:" );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- handleMojoFailureException( cause, writer );
-
- addTips( CoreErrorTips.getMojoFailureTips( binding ), writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- public void reportProjectMojoFailureException( MavenSession session,
- MojoBinding binding,
- MojoFailureException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Mojo: " );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( " " );
- writer.write( MojoBindingUtils.toString( binding ) );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "FAILED for project: " );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( " " );
- writer.write( session.getCurrentProject().getId() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Reason:" );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- handleMojoFailureException( cause, writer );
-
- addTips( CoreErrorTips.getMojoFailureTips( binding ), writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- private void handleMojoFailureException( MojoFailureException error,
- StringWriter writer )
- {
- String message = error.getLongMessage();
- if ( message == null )
- {
- message = error.getMessage();
- }
-
- writer.write( message );
- writer.write( NEWLINE );
- }
-
- public void reportProjectCycle( ProjectCycleException error )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Maven has detected a cyclic relationship among a set of projects in the current build." );
- writer.write( NEWLINE );
- writer.write( "The projects involved are:" );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- List projects = error.getProjects();
- Map projectsByVersionlessId = new HashMap();
- for ( Iterator it = projects.iterator(); it.hasNext(); )
- {
- MavenProject project = (MavenProject) it.next();
- projectsByVersionlessId.put( ArtifactUtils.versionlessKey( project.getGroupId(), project.getArtifactId() ), project );
- }
-
- CycleDetectedException cause = (CycleDetectedException) error.getCause();
- List cycle = cause.getCycle();
- for ( Iterator it = cycle.iterator(); it.hasNext(); )
- {
- String id = (String) it.next();
- MavenProject project = (MavenProject) projectsByVersionlessId.get( id );
-
- writer.write( "- " );
- writer.write( project.getId() );
- writer.write( " (path: " );
- writer.write( project.getFile().getPath() );
- writer.write( ")" );
- writer.write( NEWLINE );
- }
-
- writer.write( NEWLINE );
- writer.write( "NOTE: This cycle usually indicates two projects listing one another as dependencies, but" );
- writer.write( NEWLINE );
- writer.write( "may also indicate one project using another as a parent, plugin, or extension." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- addTips( CoreErrorTips.getProjectCycleTips( error ), writer );
-
- registerBuildError( error, writer.toString(), cause );
- }
-
- public void reportLifecycleLoaderErrorWhileValidatingTask( String task,
- MavenSession session,
- MavenProject rootProject,
- LifecycleLoaderException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Invalid mojo or lifecycle phase: " );
- writer.write( task );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- writer.write( "Original error message was: " );
- writer.write( cause.getMessage() );
-
- addTips( CoreErrorTips.getTaskValidationTips( task, cause ), writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- public void reportLifecycleSpecErrorWhileValidatingTask( String task,
- MavenSession session,
- MavenProject rootProject,
- LifecycleSpecificationException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Invalid mojo or lifecycle phase: " );
- writer.write( task );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- writer.write( "Original error message was: " );
- writer.write( cause.getMessage() );
-
- addTips( CoreErrorTips.getTaskValidationTips( task, cause ), writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- public void reportInvalidPluginExecutionEnvironment( MojoBinding binding,
- MavenProject project,
- PluginExecutionException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "The following plugin cannot function in the current build environment:" );
-
- writer.write( NEWLINE );
- writeMojoBinding( binding, writer );
-
- writer.write( "While building project:" );
- writer.write( NEWLINE );
- writeProjectCoordinate( project, writer );
-
- writer.write( NEWLINE );
- writer.write( "Reason: " );
- writer.write( cause.getMessage() );
-
- addTips( CoreErrorTips.getInvalidExecutionEnvironmentTips( binding, project, cause ), writer );
-
- registerBuildError( cause, writer.toString() );
- }
-
- public void reportMojoExecutionException( MojoBinding binding,
- MavenProject project,
- MojoExecutionException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "The following mojo encountered an error while executing:" );
-
- writeMojoBinding( binding, writer );
- writer.write( "While building project:" );
- writeProjectCoordinate( project, writer );
-
- writer.write( "Reason: " );
- writer.write( cause.getMessage() );
-
- addTips( CoreErrorTips.getMojoExecutionExceptionTips( binding, project, cause ), writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- public void reportMojoLookupError( MojoBinding binding,
- MavenProject project,
- ComponentLookupException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Maven encountered an error while looking up the following Mojo:" );
-
- writeMojoBinding( binding, writer );
- writer.write( "Referenced from project:" );
- writeProjectCoordinate( project, writer );
-
- writer.write( "Reason: " );
- writer.write( cause.getMessage() );
-
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- writer.write( "Root cause: " );
- writer.write( getRootCause( cause ).getMessage() );
-
- addTips( CoreErrorTips.getMojoLookupErrorTips( binding, project, cause ), writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- private Throwable getRootCause( Throwable cause )
- {
- Throwable nested = cause.getCause();
- if ( nested != null )
- {
- return getRootCause( nested );
- }
- else
- {
- return cause;
- }
- }
-
- public void reportAttemptToOverrideUneditableMojoParameter( Parameter currentParameter,
- MojoBinding binding,
- MavenProject project,
- MavenSession session,
- MojoExecution exec,
- PathTranslator translator,
- Logger logger,
- PluginConfigurationException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "The following mojo parameter cannot be configured:" );
-
- writeParameter( currentParameter, writer );
- writer.write( "in mojo:" );
- writeMojoBinding( binding, writer );
- writer.write( "While building project:" );
- writeProjectCoordinate( project, writer );
-
- PluginParameterExpressionEvaluator evaluator = new PluginParameterExpressionEvaluator(
- session,
- exec,
- translator,
- logger,
- session.getExecutionProperties() );
-
- Object fromDefaultValue = null;
- Object fromExpression = null;
- try
- {
- if ( currentParameter.getDefaultValue() != null )
- {
- fromDefaultValue = evaluator.evaluate( currentParameter.getDefaultValue() );
- }
-
- if ( currentParameter.getExpression() != null )
- {
- fromExpression = evaluator.evaluate( currentParameter.getExpression() );
- }
- }
- catch ( ExpressionEvaluationException e )
- {
- // ignored.
- }
-
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Instead of configuring this parameter directly, try configuring your POM or settings.xml file." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Using the default-value and expression annotations built into the mojo itself, these values were found in your build:" );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Value: " );
- writer.write( String.valueOf( fromDefaultValue ) );
- writer.write( NEWLINE );
- writer.write( "Using the expression:" );
- writer.write( currentParameter.getDefaultValue() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Value: " );
- writer.write( String.valueOf( fromExpression ) );
- writer.write( NEWLINE );
- writer.write( "Using the expression:" );
- writer.write( currentParameter.getExpression() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "If one of the above expressions rendered a valid value, it " +
- "may give some indication of which part of the POM or settings.xml " +
- "you can modify in order to change this parameter's value." );
-
- addTips( CoreErrorTips.getUneditableMojoParameterTips( currentParameter, binding, project, cause ), writer );
-
- registerBuildError( cause, writer.toString() );
- }
-
- public void reportUseOfBannedMojoParameter( Parameter currentParameter,
- MojoBinding binding,
- MavenProject project,
- String expression,
- String altExpression,
- ExpressionEvaluationException err )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "The following mojo-parameter expression is banned for use in POM configurations:" );
- writer.write( NEWLINE );
- writer.write( expression );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Please use the following expression instead:" );
- writer.write( NEWLINE );
- writer.write( altExpression );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- writeParameter( currentParameter, writer );
- writer.write( "in mojo:" );
- writeMojoBinding( binding, writer );
- writer.write( "While building project:" );
- writeProjectCoordinate( project, writer );
-
- addTips( CoreErrorTips.getBannedParameterExpressionTips( currentParameter, binding, project ), writer );
-
- registerBuildError( err, writer.toString() );
- }
-
- public void reportReflectionErrorWhileEvaluatingMojoParameter( Parameter currentParameter,
- MojoBinding binding,
- MavenProject project,
- String expression,
- Exception cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "The following mojo-parameter expression could not be resolved, due to an erroroneous or empty reference in the object graph:" );
- writer.write( NEWLINE );
- writer.write( expression );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- writeParameter( currentParameter, writer );
- writer.write( "in mojo:" );
- writeMojoBinding( binding, writer );
- writer.write( "While building project:" );
- writeProjectCoordinate( project, writer );
-
- addTips( CoreErrorTips.getReflectionErrorInParameterExpressionTips( expression, currentParameter, binding, project ), writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- public void reportMissingRequiredMojoParameter( MojoBinding binding,
- MavenProject project,
- List invalidParameters,
- PluginParameterException err )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "One or more required mojo parameters have not been configured." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- writer.write( "Mojo:" );
- writeMojoBinding( binding, writer );
- writer.write( "While building project:" );
- writeProjectCoordinate( project, writer );
-
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Missing parameters include:" );
- for ( Iterator it = invalidParameters.iterator(); it.hasNext(); )
- {
- Parameter parameter = (Parameter) it.next();
- writer.write( NEWLINE );
- writer.write( parameter.getName() );
-
- if ( parameter.getAlias() != null )
- {
- writer.write( " (aliased as: " );
- writer.write( parameter.getAlias() );
- }
- }
-
- addTips( CoreErrorTips.getMissingRequiredParameterTips( invalidParameters, binding, project ), writer );
-
- registerBuildError( err, writer.toString() );
- }
-
- public void reportErrorApplyingMojoConfiguration( MojoBinding binding,
- MavenProject project,
- PlexusConfiguration config,
- PluginConfigurationException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Maven encountered an error while configuring one of the mojos for your build." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- writer.write( "Mojo:" );
- writeMojoBinding( binding, writer );
- writer.write( "While building project:" );
- writeProjectCoordinate( project, writer );
-
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Here is the configuration it attempted to apply to the mojo:" );
- writeConfiguration( config, writer, 0 );
-
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Error message:" );
- writer.write( cause.getMessage() );
-
- addTips( CoreErrorTips.getMojoConfigurationErrorTips( binding, project, config, cause ), writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- public void reportProjectDependenciesNotFound( MavenProject project,
- String scope,
- ArtifactNotFoundException cause )
- {
- reportTransitiveResolutionError( project, scope, cause );
- }
-
- public void reportProjectDependenciesNotFound( MavenProject project,
- String scope,
- MultipleArtifactsNotFoundException cause )
- {
- reportTransitiveResolutionError( project, scope, cause );
- }
-
- public void reportProjectDependenciesUnresolvable( MavenProject project,
- String scope,
- ArtifactResolutionException cause )
- {
- reportTransitiveResolutionError( project, scope, cause );
- }
-
- private void reportTransitiveResolutionError( MavenProject project,
- String scope,
- AbstractArtifactResolutionException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Transitive dependency resolution for scope: " );
- writer.write( scope );
- writer.write( " has failed for your project." );
-
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Error message: " );
- writer.write( cause.getMessage() );
-
- Throwable root = getRootCause( cause );
- if ( root != cause )
- {
- writer.write( NEWLINE );
- writer.write( "Root error message: " );
- writer.write( root.getMessage() );
- }
-
- writeProjectCoordinate( project, writer );
- addTips( CoreErrorTips.getDependencyArtifactResolutionTips( project, scope, cause ),
- writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- private void writeArtifactError( AbstractArtifactResolutionException cause,
- StringWriter writer )
- {
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Group-Id: " );
- writer.write( cause.getGroupId() );
- writer.write( NEWLINE );
- writer.write( "Artifact-Id: " );
- writer.write( cause.getArtifactId() );
- writer.write( NEWLINE );
- writer.write( "Version: " );
- writer.write( cause.getVersion() );
- writer.write( NEWLINE );
- writer.write( "Type: " );
- writer.write( cause.getType() );
- writer.write( NEWLINE );
-
- if ( cause.getClassifier() != null )
- {
- writer.write( NEWLINE );
- writer.write( "Classifier: " );
- writer.write( cause.getClassifier() );
- }
-
- if ( cause != null )
- {
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Error message: " );
- writer.write( cause.getMessage() );
- writer.write( NEWLINE );
- writer.write( "Root error message: " );
- writer.write( getRootCause( cause ).getMessage() );
- }
- }
-
- private void writeArtifactInfo( Artifact depArtifact,
- StringWriter writer,
- boolean includeScope )
- {
- writeArtifactInfo( depArtifact, null, writer, includeScope );
- }
-
- private void writeArtifactInfo( Artifact depArtifact,
- AbstractArtifactResolutionException cause,
- StringWriter writer,
- boolean includeScope )
- {
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Group-Id: " );
- writer.write( depArtifact.getGroupId() );
- writer.write( NEWLINE );
- writer.write( "Artifact-Id: " );
- writer.write( depArtifact.getArtifactId() );
- writer.write( NEWLINE );
- writer.write( "Version: " );
- writer.write( depArtifact.getVersion() );
- writer.write( NEWLINE );
- writer.write( "Type: " );
- writer.write( depArtifact.getType() );
- writer.write( NEWLINE );
- writer.write( "Scope: " );
- writer.write( depArtifact.getScope() );
-
- if ( depArtifact.getClassifier() != null )
- {
- writer.write( NEWLINE );
- writer.write( "Classifier: " );
- writer.write( depArtifact.getClassifier() );
- }
-
- if ( cause != null )
- {
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Error message: " );
- writer.write( cause.getMessage() );
- writer.write( NEWLINE );
- writer.write( "Root error message: " );
- writer.write( getRootCause( cause ).getMessage() );
- }
- }
-
- public void reportErrorLoadingPlugin( MojoBinding binding,
- MavenProject project,
- PluginLoaderException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Maven encountered an error while loading a plugin for use in your build." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- writer.write( "Plugin:" );
- writePluginInformation( binding, writer );
- writer.write( "While building project:" );
- writeProjectCoordinate( project, writer );
-
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Error message:" );
- writer.write( cause.getMessage() );
- writer.write( NEWLINE );
- writer.write( "Root error message:" );
- writer.write( getRootCause( cause ).getMessage() );
-
- addTips( CoreErrorTips.getErrorLoadingPluginTips( binding, project, cause ), writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- public void reportErrorFormulatingBuildPlan( List tasks,
- MavenProject project,
- MavenSession session,
- LifecycleException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Maven cannot calculate your build plan, given the following information:" );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- writer.write( "Tasks:" );
- for ( Iterator it = tasks.iterator(); it.hasNext(); )
- {
- String task = (String) it.next();
- writer.write( NEWLINE );
- writer.write( "- " );
- writer.write( task );
- }
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Current project:" );
- writeProjectCoordinate( project, writer );
-
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Error message: " );
- writer.write( cause.getMessage() );
- writer.write( NEWLINE );
- writer.write( "Root error message: " );
- writer.write( getRootCause( cause ).getMessage() );
-
- addTips( CoreErrorTips.getBuildPlanningErrorTips( tasks, project, cause ), writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- public void reportInvalidMavenVersion( MavenProject project,
- ArtifactVersion mavenVersion,
- MavenExecutionException err )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "The version of Maven currently in use is incompatible with your project's prerequisite:" );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- writer.write( "Current Maven Version: " );
- writer.write( mavenVersion.toString() );
- writer.write( NEWLINE );
- writer.write( "Version required:" );
- writer.write( project.getPrerequisites().getMaven() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Project Information:" );
- writer.write( NEWLINE );
- writeProjectCoordinate( project, writer );
-
- addTips( CoreErrorTips.getIncompatibleProjectMavenVersionPrereqTips( project, mavenVersion ), writer );
-
- registerBuildError( err, writer.toString() );
- }
-
- public void handleSuperPomBuildingError( ProjectBuildingException exception )
- {
- ProjectErrorReporter projectReporter = ProjectReporterManager.getReporter();
- Throwable reportedException = projectReporter.findReportedException( exception );
- String formattedMessage = projectReporter.getFormattedMessage( reportedException );
-
- registerBuildError( exception, formattedMessage, reportedException );
- }
-
- public void reportErrorResolvingExtensionDirectDependencies( Artifact extensionArtifact,
- Artifact projectArtifact,
- List remoteRepos,
- MavenExecutionRequest request,
- ArtifactMetadataRetrievalException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Maven encountered an error while trying to resolve an the direct dependencies for a build extension used in your project." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Project:" );
- writeArtifactInfo( projectArtifact, writer, false );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Extension:" );
- writeArtifactInfo( extensionArtifact, writer, false );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Failed Artifact:" );
- writeArtifactInfo( cause.getArtifact(), writer, false );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Error message: " );
- writer.write( cause.getMessage() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Root error message: " );
- writer.write( getRootCause( cause ).getMessage() );
-
- addTips( CoreErrorTips.getErrorResolvingExtensionDirectDepsTips( extensionArtifact, projectArtifact, cause ),
- writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- private void writeCompactArtifactCoordinate( String linePrefix,
- Artifact artifact,
- StringWriter writer )
- {
- writer.write( linePrefix );
- writer.write( artifact.getGroupId() );
- writer.write( ":" );
- writer.write( artifact.getArtifactId() );
- writer.write( ":" );
- writer.write( artifact.getVersion() );
- writer.write( ":" );
- writer.write( artifact.getType() );
- if ( artifact.getClassifier() != null )
- {
- writer.write( ":" );
- writer.write( artifact.getClassifier() );
- }
- }
-
- public void reportErrorManagingRealmForExtension( Artifact extensionArtifact,
- Artifact projectArtifact,
- List remoteRepos,
- MavenExecutionRequest request,
- RealmManagementException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Maven encountered an error while trying to construct the classloader for a build extension used in your project." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Project:" );
- writeArtifactInfo( projectArtifact, writer, false );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Extension:" );
- writeArtifactInfo( extensionArtifact, writer, false );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Error message: " );
- writer.write( cause.getMessage() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Root error message: " );
- writer.write( getRootCause( cause ).getMessage() );
-
- addTips( CoreErrorTips.getErrorManagingExtensionRealmTips( extensionArtifact, projectArtifact, cause ),
- writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- public void reportErrorConfiguringExtensionPluginRealm( Plugin plugin,
- Model originModel,
- List remoteRepos,
- MavenExecutionRequest request,
- RealmManagementException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Maven encountered an error while trying to construct the classloader for a plugin used by your project as a build extension." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Project:" );
- writeProjectCoordinate( originModel, null, writer );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Plugin (used as an extension):" );
- writePluginInfo( plugin, writer );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Error message: " );
- writer.write( cause.getMessage() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Root error message: " );
- writer.write( getRootCause( cause ).getMessage() );
-
- addTips( CoreErrorTips.getErrorManagingExtensionPluginRealmTips( plugin, originModel, cause ),
- writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- private void writePluginInfo( Plugin plugin,
- StringWriter writer )
- {
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Group-Id: " );
- writer.write( plugin.getGroupId() );
- writer.write( NEWLINE );
- writer.write( "Artifact-Id: " );
- writer.write( plugin.getArtifactId() );
- writer.write( NEWLINE );
- writer.write( "Version: " );
- writer.write( plugin.getVersion() );
- writer.write( NEWLINE );
- }
-
- public void reportUnresolvableArtifactWhileAddingExtensionPlugin( Plugin plugin,
- Model originModel,
- List remoteRepos,
- MavenExecutionRequest request,
- ArtifactResolutionException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Maven failed to resolve one or more dependency artifacts for a plugin used by your project as a build extension." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Project:" );
- writeProjectCoordinate( originModel, null, writer );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Plugin (used as an extension):" );
- writePluginInfo( plugin, writer );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writeArtifactError( cause, writer );
-
- addTips( CoreErrorTips.getErrorResolvingExtensionPluginArtifactsTips( plugin, originModel, cause ),
- writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- public void reportExtensionPluginArtifactNotFound( Plugin plugin,
- Model originModel,
- List remoteRepos,
- MavenExecutionRequest request,
- AbstractArtifactResolutionException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "The artifact for a plugin used by your project as a build extension was not found." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Project:" );
- writeProjectCoordinate( originModel, null, writer );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Plugin (used as an extension):" );
- writePluginInfo( plugin, writer );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writeArtifactError( cause, writer );
-
- addTips( CoreErrorTips.getErrorResolvingExtensionPluginArtifactsTips( plugin, originModel, cause ),
- writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- public void reportUnresolvableExtensionPluginVersion( Plugin plugin,
- Model originModel,
- List remoteRepos,
- MavenExecutionRequest request,
- PluginVersionResolutionException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Maven could not resolve a valid version for a plugin used by your project as a build extension." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Project:" );
- writeProjectCoordinate( originModel, null, writer );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Plugin (used as an extension):" );
- writePluginInfo( plugin, writer );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Error message: " );
- writer.write( cause.getMessage() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Root error message: " );
- writer.write( getRootCause( cause ).getMessage() );
-
- addTips( CoreErrorTips.getErrorResolvingExtensionPluginVersionTips( plugin, originModel, cause ),
- writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- public void reportInvalidDependencyVersionInExtensionPluginPOM( Plugin plugin,
- Model originModel,
- List remoteRepos,
- MavenExecutionRequest request,
- InvalidDependencyVersionException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Maven encountered an invalid version among the dependencies of a plugin used by your project as a build extension." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Project:" );
- writeProjectCoordinate( originModel, null, writer );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Plugin (used as an extension):" );
- writePluginInfo( plugin, writer );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- writer.write( "Dependency:" );
- Dependency dep = cause.getDependency();
- writer.write( NEWLINE );
- writer.write( "Group-Id: " );
- writer.write( dep.getGroupId() );
- writer.write( NEWLINE );
- writer.write( "Artifact-Id: " );
- writer.write( dep.getArtifactId() );
- writer.write( NEWLINE );
- writer.write( "Version: " );
- writer.write( dep.getVersion() );
- writer.write( NEWLINE );
- writer.write( "Type: " );
- writer.write( dep.getType() );
- writer.write( NEWLINE );
- writer.write( "Scope: " );
- writer.write( dep.getScope() );
- if ( dep.getClassifier() != null )
- {
- writer.write( NEWLINE );
- writer.write( "Classifier: " );
- writer.write( dep.getClassifier() );
- }
-
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Error message: " );
- writer.write( cause.getMessage() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Root error message: " );
- writer.write( getRootCause( cause ).getMessage() );
-
- addTips( CoreErrorTips.getInvalidDependencyVersionForExtensionPluginTips( plugin, originModel, cause ),
- writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- public void reportErrorSearchingforCompatibleExtensionPluginVersion( Plugin plugin,
- Model originModel,
- List remoteRepos,
- MavenExecutionRequest request,
- String requiredMavenVersion,
- String currentMavenVersion,
- InvalidVersionSpecificationException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Maven encountered an incompatible version of a plugin used by your project as a build extension." );
- writer.write( " In attempting to search for an older version of this plugin, Maven failed to construct a valid version range for the search." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Project:" );
- writeProjectCoordinate( originModel, null, writer );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Plugin (used as an extension):" );
- writePluginInfo( plugin, writer );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- writer.write( "Current Maven version: " );
- writer.write( currentMavenVersion );
- writer.write( NEWLINE );
- writer.write( "Plugin requires Maven version: " );
- writer.write( requiredMavenVersion );
-
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Error message: " );
- writer.write( cause.getMessage() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Root error message: " );
- writer.write( getRootCause( cause ).getMessage() );
-
- addTips( CoreErrorTips.getInvalidPluginVersionRangeForExtensionPluginTips( plugin, originModel, requiredMavenVersion, currentMavenVersion, cause ),
- writer );
-
- registerBuildError( cause, writer.toString() );
- }
-
- public void reportErrorSearchingforCompatibleExtensionPluginVersion( Plugin plugin,
- Model originModel,
- List remoteRepos,
- MavenExecutionRequest request,
- String requiredMavenVersion,
- String currentMavenVersion,
- ArtifactMetadataRetrievalException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Maven encountered an incompatible version of a plugin used by your project as a build extension." );
- writer.write( " In attempting to search for an older version of this plugin, Maven failed to retrieve the list of available plugin versions." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Project:" );
- writeProjectCoordinate( originModel, null, writer );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Plugin (used as an extension):" );
- writePluginInfo( plugin, writer );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- writer.write( "Current Maven version: " );
- writer.write( currentMavenVersion );
- writer.write( NEWLINE );
- writer.write( "Plugin requires Maven version: " );
- writer.write( requiredMavenVersion );
-
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Error message: " );
- writer.write( cause.getMessage() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Root error message: " );
- writer.write( getRootCause( cause ).getMessage() );
-
- addTips( CoreErrorTips.getInvalidPluginVersionRangeForExtensionPluginTips( plugin, originModel, requiredMavenVersion, currentMavenVersion, cause ),
- writer );
-
- registerBuildError( cause, writer.toString() );
- }
-
- public void reportIncompatibleMavenVersionForExtensionPlugin( Plugin plugin,
- Model originModel,
- List remoteRepos,
- MavenExecutionRequest request,
- String requiredMavenVersion,
- String currentMavenVersion,
- PluginVersionResolutionException err )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Maven encountered an incompatible version of a plugin used by your project as a build extension." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Project:" );
- writeProjectCoordinate( originModel, null, writer );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Plugin (used as an extension):" );
- writePluginInfo( plugin, writer );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- writer.write( "Current Maven version: " );
- writer.write( currentMavenVersion );
- writer.write( NEWLINE );
- writer.write( "Plugin requires Maven version: " );
- writer.write( requiredMavenVersion );
-
- addTips( CoreErrorTips.getInvalidPluginVersionRangeForExtensionPluginTips( plugin, originModel, requiredMavenVersion, currentMavenVersion ),
- writer );
-
- registerBuildError( err, writer.toString() );
- }
-
- public void reportUnresolvableExtensionPluginPOM( Plugin plugin,
- Model originModel,
- List remoteRepos,
- MavenExecutionRequest request,
- ArtifactMetadataRetrievalException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Maven failed to resolve the POM of a plugin used by your project as a build extension." );
- writer.write( NEWLINE );
- writer.write( "Without the POM, it is impossible to discover or resolve the plugin's dependencies." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Project:" );
- writeProjectCoordinate( originModel, null, writer );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Plugin (used as an extension):" );
- writePluginInfo( plugin, writer );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Error message: " );
- writer.write( cause.getMessage() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Root error message: " );
- writer.write( getRootCause( cause ).getMessage() );
-
- addTips( CoreErrorTips.getUnresolvableExtensionPluginPOMTips( plugin, originModel, cause ),
- writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- public void reportErrorConfiguringExtensionPluginRealm( Plugin plugin,
- Model originModel,
- List remoteRepos,
- MavenExecutionRequest request,
- PluginManagerException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Maven failed to construct the classloader for a plugin used by your project as a build extension." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Project:" );
- writeProjectCoordinate( originModel, null, writer );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Plugin (used as an extension):" );
- writePluginInfo( plugin, writer );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Error message: " );
- writer.write( cause.getMessage() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Root error message: " );
- writer.write( getRootCause( cause ).getMessage() );
-
- addTips( CoreErrorTips.getErrorManagingExtensionPluginRealmTips( plugin, originModel, cause ),
- writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- public void reportExtensionPluginVersionNotFound( Plugin plugin,
- Model originModel,
- List remoteRepos,
- MavenExecutionRequest request,
- PluginVersionNotFoundException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Maven failed to resolve a valid version for a plugin used by your project as a build extension." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Project:" );
- writeProjectCoordinate( originModel, null, writer );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Plugin (used as an extension):" );
- writePluginInfo( plugin, writer );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Error message: " );
- writer.write( cause.getMessage() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Root error message: " );
- writer.write( getRootCause( cause ).getMessage() );
-
- addTips( CoreErrorTips.getExtensionPluginVersionNotFoundTips( plugin, originModel, cause ),
- writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- private void writeParameter( Parameter currentParameter,
- StringWriter writer )
- {
- writer.write( NEWLINE );
- writer.write( "Uneditable parameter:" );
- writer.write( NEWLINE );
- writer.write( "Name: " );
- writer.write( currentParameter.getName() );
- writer.write( NEWLINE );
- writer.write( "Alias: " );
- writer.write( currentParameter.getAlias() );
- writer.write( NEWLINE );
- }
-
- private void writeProjectCoordinate( MavenProject project,
- StringWriter writer )
- {
- writer.write( NEWLINE );
- if ( project == null )
- {
- writer.write( "No project is in use." );
- }
- else
- {
- writer.write( "Group-Id: " );
- writer.write( project.getGroupId() );
- writer.write( NEWLINE );
- writer.write( "Artifact-Id: " );
- writer.write( project.getArtifactId() );
- writer.write( NEWLINE );
- writer.write( "Version: " );
- writer.write( project.getVersion() );
- writer.write( NEWLINE );
- writer.write( "From file: " );
- writer.write( String.valueOf( project.getFile() ) );
- }
- writer.write( NEWLINE );
- }
-
- private void writeProjectCoordinate( Model model,
- File pomFile,
- StringWriter writer )
- {
- writer.write( NEWLINE );
- writer.write( "Group-Id: " );
- writer.write( model.getGroupId() );
- writer.write( NEWLINE );
- writer.write( "Artifact-Id: " );
- writer.write( model.getArtifactId() );
- writer.write( NEWLINE );
- writer.write( "Version: " );
- writer.write( model.getVersion() );
- writer.write( NEWLINE );
- writer.write( "From file: " );
- writer.write( pomFile == null ? "Not captured for this error report." : pomFile.getAbsolutePath() );
- writer.write( NEWLINE );
- }
-
- private void writePluginInformation( MojoBinding binding,
- StringWriter writer )
- {
- writer.write( NEWLINE );
- writer.write( "Group-Id: " );
- writer.write( binding.getGroupId() );
- writer.write( NEWLINE );
- writer.write( "Artifact-Id: " );
- writer.write( binding.getArtifactId() );
- writer.write( NEWLINE );
- writer.write( "Version: " );
- writer.write( binding.getVersion() );
- writer.write( NEWLINE );
- writer.write( "Referenced mojo: " );
- writer.write( binding.getGoal() );
- writer.write( NEWLINE );
- writer.write( "brought in via: " );
- writer.write( binding.getOrigin() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- }
-
- private void writeMojoBinding( MojoBinding binding, StringWriter writer )
- {
- writer.write( NEWLINE );
- writer.write( "Group-Id: " );
- writer.write( binding.getGroupId() );
- writer.write( NEWLINE );
- writer.write( "Artifact-Id: " );
- writer.write( binding.getArtifactId() );
- writer.write( NEWLINE );
- writer.write( "Version: " );
- writer.write( binding.getVersion() );
- writer.write( NEWLINE );
- writer.write( "Mojo: " );
- writer.write( binding.getGoal() );
- writer.write( NEWLINE );
- writer.write( "brought in via: " );
- writer.write( binding.getOrigin() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- }
-
- private void writeConfiguration( PlexusConfiguration config,
- StringWriter writer, int indent )
- {
- indent( writer, indent );
-
- writer.write( "<" );
- writer.write( config.getName() );
- writer.write( ">" );
-
- try
- {
- if ( config.getValue() != null )
- {
- writer.write( config.getValue() );
- }
- }
- catch ( PlexusConfigurationException e )
- {
- // skip it.
- }
-
- PlexusConfiguration[] children = config.getChildren();
- if ( ( children != null ) && ( children.length > 0 ) )
- {
- for ( int i = 0; i < children.length; i++ )
- {
- writer.write( NEWLINE );
- writeConfiguration( children[i], writer, indent + 1 );
- }
-
- indent( writer, indent );
- }
-
- writer.write( "" );
- writer.write( config.getName() );
- writer.write( ">" );
- writer.write( NEWLINE );
- }
-
- private void indent( StringWriter writer,
- int indent )
- {
- for ( int i = 0; i < indent; i++ )
- {
- writer.write( " " );
- }
- }
-
- public void reportMissingModulePom( MissingModuleException err )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "The module: " );
- writer.write( err.getModuleName() );
- writer.write( " cannot be found." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Module's expected path: " );
- writer.write( NEWLINE );
- writer.write( err.getModuleFile().getAbsolutePath() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Referenced by POM: " );
- writer.write( NEWLINE );
- writer.write( err.getPomFile().getAbsolutePath() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- addTips( CoreErrorTips.getMissingModuleTips( err.getPomFile(), err.getModuleFile(), err.getModuleName() ), writer );
-
- registerBuildError( err, writer.toString() );
- }
-
- public void reportInvalidPluginForDirectInvocation( String task,
- MavenSession session,
- MavenProject project,
- InvalidPluginException err )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Maven encountered an error while loading a plugin for use in your build." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- writer.write( "Original task invocation:" );
- writer.write( task );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "While building project:" );
- writeProjectCoordinate( project, writer );
-
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Error message:" );
- writer.write( NEWLINE );
- writer.write( err.getMessage() );
-
- addTips( CoreErrorTips.getInvalidPluginForDirectInvocationTips( task, session, project, err ), writer );
-
- registerBuildError( err, writer.toString() );
- }
-
- public void reportDuplicateAttachmentException( MojoBinding binding,
- MavenProject project,
- DuplicateArtifactAttachmentException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Your build attempted to attach multiple artifacts with the same classifier to the main project." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- writer.write( "Mojo responsible for second attachment attempt:" );
- writer.write( MojoBindingUtils.toString( binding ) );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Reported for project:" );
- // Note: Using cause.getProject(), since an aggregator mojo (or, really, any sort)
- // could try to attach to any of the projects in the reactor, and in the case of the aggregator,
- // the project passed into the mojo execution and passed on here would just be the root project.
- writeProjectCoordinate( cause.getProject(), writer );
-
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Artifact attachment:" );
- writeArtifactInfo( cause.getArtifact(), writer, false );
-
- addTips( CoreErrorTips.getDuplicateAttachmentTips( binding, project, cause ), writer );
-
- registerBuildError( cause, writer.toString() );
- }
-
-}
diff --git a/maven-core/src/main/java/org/apache/maven/errors/DefaultProjectErrorReporter.java b/maven-core/src/main/java/org/apache/maven/errors/DefaultProjectErrorReporter.java
deleted file mode 100644
index 70dc0fd1b3..0000000000
--- a/maven-core/src/main/java/org/apache/maven/errors/DefaultProjectErrorReporter.java
+++ /dev/null
@@ -1,618 +0,0 @@
-package org.apache.maven.errors;
-
-import org.apache.maven.artifact.InvalidRepositoryException;
-import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.AbstractArtifactResolutionException;
-import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.model.DeploymentRepository;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Parent;
-import org.apache.maven.model.Profile;
-import org.apache.maven.model.Repository;
-import org.apache.maven.profiles.ProfileActivationContext;
-import org.apache.maven.execution.DuplicateProjectException;
-import org.apache.maven.project.*;
-import org.apache.maven.project.artifact.InvalidDependencyVersionException;
-import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-public class DefaultProjectErrorReporter
- implements ProjectErrorReporter
-{
-
- private static final String NEWLINE = "\n";
-
- private Map formattedMessages;
-
- private Map realCauses;
-
- private Map stackTraceRecommendations;
-
- public DefaultProjectErrorReporter( Map formattedMessageStore, Map realCauseStore, Map stackTraceRecommendationStore )
- {
- formattedMessages = formattedMessageStore;
- realCauses = realCauseStore;
- stackTraceRecommendations = stackTraceRecommendationStore;
- }
-
- public DefaultProjectErrorReporter()
- {
- formattedMessages = new LinkedHashMap();
- realCauses = new HashMap();
- stackTraceRecommendations = new HashMap();
- }
-
- /**
- * @see ProjectErrorReporter#clearErrors()
- */
- public void clearErrors()
- {
- formattedMessages.clear();
- realCauses.clear();
- }
-
- public List getReportedExceptions()
- {
- return new ArrayList( formattedMessages.keySet() );
- }
-
- /**
- */
- public Throwable findReportedException( Throwable error )
- {
- if ( formattedMessages.containsKey( error ) )
- {
- return error;
- }
- else if ( error.getCause() != null )
- {
- return findReportedException( error.getCause() );
- }
-
- return null;
- }
-
- /**
- * @see ProjectErrorReporter#getFormattedMessage(java.lang.Throwable)
- */
- public String getFormattedMessage( Throwable error )
- {
- return (String) formattedMessages.get( error );
- }
-
- /**
- * @see ProjectErrorReporter#getRealCause(java.lang.Throwable)
- */
- public Throwable getRealCause( Throwable error )
- {
- return (Throwable) realCauses.get( error );
- }
-
- public boolean isStackTraceRecommended( Throwable error )
- {
- Boolean rec = (Boolean) stackTraceRecommendations.get( error );
-
- if ( rec == null )
- {
- return false;
- }
-
- return rec.booleanValue();
- }
-
- protected void setStackTraceRecommendation( Throwable error, boolean recommended )
- {
- stackTraceRecommendations.put( error, Boolean.valueOf( recommended ) );
- }
-
- protected void registerBuildError( Throwable error,
- String formattedMessage,
- Throwable realCause )
- {
- formattedMessages.put( error, formattedMessage );
- realCauses.put( error, realCause );
- }
-
- protected void registerBuildError( Throwable error,
- String formattedMessage )
- {
- formattedMessages.put( error, formattedMessage );
- }
-
-
- public void reportActivatorLookupError( Model model,
- File pomFile,
- Profile profile,
- ProfileActivationContext context,
- ComponentLookupException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Error retrieving profile-activator component while processing profile:" );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( profile.getId() );
- writer.write( " (source: " );
- writer.write( profile.getSource() );
- writer.write( ")" );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Error message: " );
- writer.write( NEWLINE );
- writer.write( cause.getMessage() );
-
- addStandardInfo( model.getId(), pomFile, writer );
- addTips( ProjectErrorTips.getTipsForActivatorLookupError( model.getId(),
- pomFile,
- profile,
- cause ), writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- /**
- * @see ProjectErrorReporter#reportErrorLoadingExternalProfilesFromFile(org.apache.maven.model.Model, java.io.File, java.io.File, java.io.IOException)
- */
- public void reportErrorLoadingExternalProfilesFromFile( Model model,
- File pomFile,
- File projectDir,
- IOException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Failed to load external profiles from project directory: " );
- writer.write( NEWLINE );
- writer.write( String.valueOf( projectDir ) );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Error message: " );
- writer.write( NEWLINE );
- writer.write( cause.getMessage() );
-
- addStandardInfo( model.getId(), pomFile, writer );
- addTips( ProjectErrorTips.getTipsForErrorLoadingExternalProfilesFromFile( model,
- pomFile,
- projectDir,
- cause ), writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- /**
- * @see ProjectErrorReporter#reportErrorLoadingExternalProfilesFromFile(org.apache.maven.model.Model, java.io.File, java.io.File, org.codehaus.plexus.util.xml.pull.XmlPullParserException)
- */
- public void reportErrorLoadingExternalProfilesFromFile( Model model,
- File pomFile,
- File projectDir,
- XmlPullParserException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Failed to load external profiles from project directory: " );
- writer.write( NEWLINE );
- writer.write( String.valueOf( projectDir ) );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Error message: " );
- writer.write( NEWLINE );
- writer.write( cause.getMessage() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Line: " );
- writer.write( cause.getLineNumber() );
- writer.write( NEWLINE );
- writer.write( "Column: " );
- writer.write( cause.getColumnNumber() );
-
- addStandardInfo( model.getId(), pomFile, writer );
- addTips( ProjectErrorTips.getTipsForErrorLoadingExternalProfilesFromFile( model,
- pomFile,
- projectDir,
- cause ), writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
-
- public void reportInvalidRepositoryWhileGettingRepositoriesFromProfiles( Repository repo,
- Model model,
- File pomFile,
- InvalidRepositoryException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Invalid repository declaration: " );
- writer.write( repo.getId() );
- writer.write( NEWLINE );
- writer.write( "(URL: " );
- writer.write( repo.getUrl() );
- writer.write( ")" );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Error message: " );
- writer.write( NEWLINE );
- writer.write( cause.getMessage() );
-
- addStandardInfo( model.getId(), pomFile, writer );
- addTips( ProjectErrorTips.getTipsForInvalidRepositorySpec( repo, model.getId(), pomFile, cause ),
- writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- private void addStandardInfo( String projectId,
- File pomFile,
- StringWriter writer )
- {
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Project Id: " );
- writer.write( projectId );
- writer.write( NEWLINE );
- writer.write( "From file: " );
- writer.write( String.valueOf( pomFile ) );
- }
-
- private void addTips( List tips,
- StringWriter writer )
- {
- if ( ( tips != null ) && !tips.isEmpty() )
- {
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Some tips:" );
- for ( Iterator it = tips.iterator(); it.hasNext(); )
- {
- String tip = (String) it.next();
-
- writer.write( NEWLINE );
- writer.write( "\t- " );
- writer.write( tip );
- }
- }
- }
-
- public void reportErrorCreatingArtifactRepository( String projectId,
- File pomFile,
- Repository repo,
- InvalidRepositoryException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "You have an invalid repository/pluginRepository declaration in your POM:" );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Repository-Id: " );
- writer.write( cause.getRepositoryId() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Reason: " );
- writer.write( cause.getMessage() );
- writer.write( NEWLINE );
-
- addStandardInfo( projectId, pomFile, writer );
- addTips( ProjectErrorTips.getTipsForInvalidRepositorySpec( repo, projectId, pomFile, cause ),
- writer );
-
- registerBuildError( cause, writer.toString() );
- }
-
- public void reportErrorCreatingDeploymentArtifactRepository( MavenProject project,
- File pomFile,
- DeploymentRepository repo,
- InvalidRepositoryException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "You have an invalid repository/snapshotRepository declaration in the section of your POM:" );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Repository-Id: " );
- writer.write( cause.getRepositoryId() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Reason: " );
- writer.write( cause.getMessage() );
- writer.write( NEWLINE );
-
- addStandardInfo( project.getId(), pomFile, writer );
- addTips( ProjectErrorTips.getTipsForInvalidRepositorySpec( repo, project.getId(), pomFile, cause ),
- writer );
-
- registerBuildError( cause, writer.toString() );
- }
-
-
- public void reportProjectValidationFailure( MavenProject project,
- File pomFile,
- InvalidProjectModelException error )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "The following POM validation errors were detected:" );
- writer.write( NEWLINE );
-
- for ( Iterator it = error.getValidationResult().getMessages().iterator(); it.hasNext(); )
- {
- String message = (String) it.next();
- writer.write( NEWLINE );
- writer.write( " - " );
- writer.write( message );
- }
-
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- addStandardInfo( project.getId(), pomFile, writer );
- addTips( ProjectErrorTips.getTipsForProjectValidationFailure( project, pomFile, error.getValidationResult() ),
- writer );
-
- registerBuildError( error, writer.toString() );
- }
-
- public void reportBadManagedDependencyVersion( MavenProject project,
- File pomFile,
- InvalidDependencyVersionException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Your project declares a dependency with an invalid version inside its section." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- Dependency dep = cause.getDependency();
- writer.write( "Dependency:" );
- writer.write( NEWLINE );
- writer.write( "Group-Id: " );
- writer.write( dep.getGroupId() );
- writer.write( NEWLINE );
- writer.write( "Artifact-Id: " );
- writer.write( dep.getArtifactId() );
- writer.write( NEWLINE );
- writer.write( "Version: " );
- writer.write( dep.getVersion() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- writer.write( "Reason: " );
- writer.write( cause.getMessage() );
- writer.write( NEWLINE );
-
- addStandardInfo( project.getId(), pomFile, writer );
- addTips( ProjectErrorTips.getTipsForBadDependencySpec( project, pomFile, dep ),
- writer );
-
- registerBuildError( cause, writer.toString() );
- }
-
- public void reportBadDependencyVersion( MavenProject project,
- File pomFile,
- InvalidDependencyVersionException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Your project declares a dependency with an invalid version." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- Dependency dep = cause.getDependency();
- writer.write( "Dependency:" );
- writer.write( NEWLINE );
- writer.write( "Group-Id: " );
- writer.write( dep.getGroupId() );
- writer.write( NEWLINE );
- writer.write( "Artifact-Id: " );
- writer.write( dep.getArtifactId() );
- writer.write( NEWLINE );
- writer.write( "Version: " );
- writer.write( dep.getVersion() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- writer.write( "Reason: " );
- writer.write( cause.getMessage() );
- writer.write( NEWLINE );
-
- addStandardInfo( project.getId(), pomFile, writer );
- addTips( ProjectErrorTips.getTipsForBadDependencySpec( project, pomFile, dep ),
- writer );
-
- registerBuildError( cause, writer.toString() );
- }
-
- public void reportErrorParsingProjectModel( String projectId,
- File pomFile,
- XmlPullParserException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- if ( pomFile == null )
- {
- writer.write( "Error parsing built-in super POM!" );
- }
- else
- {
- writer.write( "Error parsing POM." );
- }
-
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( cause.getMessage() );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Line: " );
- writer.write( "" + ( cause ).getLineNumber() );
- writer.write( NEWLINE );
- writer.write( "Column: " );
- writer.write( "" + ( cause ).getColumnNumber() );
- writer.write( NEWLINE );
-
- addStandardInfo( projectId, pomFile, writer );
- addTips( ProjectErrorTips.getTipsForPomParsingError( projectId, pomFile, cause ),
- writer );
-
- registerBuildError( cause, writer.toString() );
- }
-
- public void reportErrorParsingProjectModel( String projectId,
- File pomFile,
- IOException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- if ( pomFile == null )
- {
- writer.write( "Error reading built-in super POM!" );
- }
- else
- {
- writer.write( "Error reading POM." );
- }
-
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( cause.getMessage() );
- writer.write( NEWLINE );
-
- addStandardInfo( projectId, pomFile, writer );
- addTips( ProjectErrorTips.getTipsForPomParsingError( projectId, pomFile, cause ),
- writer );
-
- registerBuildError( cause, writer.toString() );
- }
-
- public void reportParentPomArtifactNotFound( Parent parentRef,
- ProjectBuilderConfiguration config,
- List remoteRepos,
- String childId,
- File childPomFile,
- ArtifactNotFoundException cause )
- {
- reportArtifactError( parentRef, config, remoteRepos, childId, childPomFile, cause );
- }
-
- public void reportParentPomArtifactUnresolvable( Parent parentRef,
- ProjectBuilderConfiguration config,
- List remoteRepos,
- String childId,
- File childPomFile,
- ArtifactResolutionException cause )
- {
- reportArtifactError( parentRef, config, remoteRepos, childId, childPomFile, cause );
- }
-
- private void reportArtifactError( Parent parentRef,
- ProjectBuilderConfiguration config,
- List remoteRepos,
- String childId,
- File childPomFile,
- AbstractArtifactResolutionException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Failed to resolve parent-POM from repository." );
-
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Parent POM Information: " );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Group-Id: " );
- writer.write( parentRef.getGroupId() );
- writer.write( NEWLINE );
- writer.write( "Artifact-Id: " );
- writer.write( parentRef.getArtifactId() );
- writer.write( NEWLINE );
- writer.write( "Version: " );
- writer.write( parentRef.getVersion() );
-
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Local Repository: " );
- writer.write( config.getLocalRepository().getBasedir() );
-
- if ( ( remoteRepos != null ) && !remoteRepos.isEmpty() )
- {
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Remote Repositories: " );
-
- for ( Iterator it = remoteRepos.iterator(); it.hasNext(); )
- {
- ArtifactRepository remoteRepo = (ArtifactRepository) it.next();
- writer.write( NEWLINE );
- writer.write( remoteRepo.getId() );
- writer.write( " -> " );
- writer.write( remoteRepo.getUrl() );
- // TODO: Get mirrors!!
- }
- }
-
-
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Reason: " );
- writer.write( cause.getMessage() );
- writer.write( NEWLINE );
-
- addStandardInfo( childId, childPomFile, writer );
- addTips( ProjectErrorTips.getTipsForPomParsingError( childId, childPomFile, cause ),
- writer );
-
- registerBuildError( cause, writer.toString() );
- }
-
- public void reportProjectCollision( List allProjectInstances,
- DuplicateProjectException err )
- {
-
- File existing = err.getExistingProjectFile();
- File conflicting = err.getConflictingProjectFile();
- String projectId = err.getProjectId();
-
- StringWriter writer = new StringWriter();
-
- writer.write( "Duplicated project detected." );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "Project: " + projectId );
- writer.write( NEWLINE );
- writer.write( "File: " );
- writer.write( String.valueOf( existing ) );
- writer.write( NEWLINE );
- writer.write( "File: " );
- writer.write( String.valueOf( conflicting ) );
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- writer.write( "NOTE: Each project in a Maven build must have a unique combination of groupId and artifactId." );
-
- addTips( ProjectErrorTips.getTipsForDuplicateProjectError( allProjectInstances, err ),
- writer );
-
- registerBuildError( err, writer.toString() );
- }
-}
diff --git a/maven-core/src/main/java/org/apache/maven/errors/ProjectErrorReporter.java b/maven-core/src/main/java/org/apache/maven/errors/ProjectErrorReporter.java
deleted file mode 100644
index 1223f0defc..0000000000
--- a/maven-core/src/main/java/org/apache/maven/errors/ProjectErrorReporter.java
+++ /dev/null
@@ -1,238 +0,0 @@
-package org.apache.maven.errors;
-
-import org.apache.maven.artifact.InvalidRepositoryException;
-import org.apache.maven.model.DeploymentRepository;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Profile;
-import org.apache.maven.model.Repository;
-import org.apache.maven.profiles.ProfileActivationContext;
-import org.apache.maven.execution.DuplicateProjectException;
-import org.apache.maven.project.InvalidProjectModelException;
-import org.apache.maven.project.InvalidProjectVersionException;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.artifact.InvalidDependencyVersionException;
-import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.List;
-
-public interface ProjectErrorReporter
-{
-
- void clearErrors();
-
- String getFormattedMessage( Throwable error );
-
- Throwable getRealCause( Throwable error );
-
- List getReportedExceptions();
-
- Throwable findReportedException( Throwable error );
-
- boolean isStackTraceRecommended( Throwable error );
-
- /**
- * Call Stack:
- *
- *
- * DefaultProfileAdvisor.applyActivatedProfiles(..)
- * DefaultProfileAdvisor.applyActivatedExternalProfiles(..)
- * --> DefaultProfileAdvisor.applyActivatedProfiles(..) (private)
- * --> DefaultProfileAdvisor.getArtifactRepositoriesFromActiveProfiles(..)
- * --> DefaultProfileManager.getActiveProfiles(..)
- * --> DefaultProfileManager.isActive(..) (private)
- * --> PlexusContainer.lookupList(..)
- * <-- ComponentLookupException
- * <-- ProfileActivationException
- * <------ ProjectBuildingException
- *
- */
- void reportActivatorLookupError( Model model,
- File pomFile,
- Profile profile,
- ProfileActivationContext context,
- ComponentLookupException cause );
-
- /**
- * Call Stack:
- *
- *
- * DefaultProfileAdvisor.applyActivatedProfiles(..)
- * DefaultProfileAdvisor.getArtifactRepositoriesFromActiveProfiles(..)
- * --> DefaultProfileAdvisor.buildProfileManager(..) (private)
- * --> DefaultProfileAdvisor.loadExternalProjectProfiles(..) (private)
- * --> MavenProfilesBuilder.buildProfiles(..)
- * <-- IOException
- * <------ ProjectBuildingException
- *
- */
- void reportErrorLoadingExternalProfilesFromFile( Model model,
- File pomFile,
- File projectDir,
- IOException cause );
-
- /**
- * Call Stack:
- *
- *
- * DefaultProfileAdvisor.applyActivatedProfiles(..)
- * DefaultProfileAdvisor.getArtifactRepositoriesFromActiveProfiles(..)
- * --> DefaultProfileAdvisor.buildProfileManager(..) (private)
- * --> DefaultProfileAdvisor.loadExternalProjectProfiles(..) (private)
- * --> MavenProfilesBuilder.buildProfiles(..)
- * <-- XmlPullParserException
- * <------ ProjectBuildingException
- *
- */
- void reportErrorLoadingExternalProfilesFromFile( Model model,
- File pomFile,
- File projectDir,
- XmlPullParserException cause );
-
- /**
- * Call Stack:
- *
- *
- * DefaultProfileAdvisor.applyActivatedProfiles(..)
- * DefaultProfileAdvisor.applyActivatedExternalProfiles(..)
- * --> DefaultProfileAdvisor.getArtifactRepositoriesFromActiveProfiles(..)
- * --> MavenTools.buildArtifactRepository(..)
- * <-- InvalidRepositoryException
- * <-- ProjectBuildingException
- *
- */
- void reportInvalidRepositoryWhileGettingRepositoriesFromProfiles( Repository repo,
- Model model,
- File pomFile,
- InvalidRepositoryException cause );
-
- /**
- * Call Stack:
- *
- *
- * ...
- * --> DefaultMavenProjectBuilder.buildFromRepository(..)
- * DefaultMavenProjectBuilder.build(..)
- * --> DefaultMavenProjectBuilder.buildFromSourceFileInternal(..) (private)
- * --> DefaultMavenProjectBuilder.buildInternal(..) (private)
- * --> DefaultMavenProjectBuilder.processProjectLogic(..) (private)
- * --> DefaultMavenTools.buildDeploymentArtifactRepository(..)
- * <-- UnknownRepositoryLayoutException
- * <-------- ProjectBuildingException
- *
- */
- void reportErrorCreatingDeploymentArtifactRepository( MavenProject project,
- File pomFile,
- DeploymentRepository repo,
- InvalidRepositoryException cause );
-
- /**
- * Call Stack:
- *
- *
- * ...
- * --> DefaultMavenProjectBuilder.buildFromRepository(..)
- * DefaultMavenProjectBuilder.build(..)
- * --> DefaultMavenProjectBuilder.buildFromSourceFileInternal(..) (private)
- * --> DefaultMavenProjectBuilder.buildInternal(..) (private)
- * --> DefaultMavenProjectBuilder.processProjectLogic(..) (private)
- * --> DefaultMavenTools.buildArtifactRepositories(..)
- * --> DefaultMavenTools.buildArtifactRepository(..)
- * <------ UnknownRepositoryLayoutException
- * <---------- ProjectBuildingException
- *
- */
- void reportErrorCreatingArtifactRepository( String projectId,
- File pomFile,
- Repository repo,
- InvalidRepositoryException cause );
-
-
- /**
- * Call Stack:
- *
- *
- * ...
- * --> DefaultMavenProjectBuilder.buildFromRepository(..)
- * DefaultMavenProjectBuilder.build(..)
- * --> DefaultMavenProjectBuilder.buildFromSourceFileInternal(..) (private)
- * --> DefaultMavenProjectBuilder.buildInternal(..) (private)
- * --> DefaultMavenProjectBuilder.processProjectLogic(..) (private)
- * --> (model validator result)
- * <-- InvalidProjectModelException
- * <---------- ProjectBuildingException
- *
- */
- void reportProjectValidationFailure( MavenProject project,
- File pomFile,
- InvalidProjectModelException error );
-
- /**
- * Call Stack:
- *
- *
- * ...
- * --> MavenProject.createArtifacts(..)
- * --> MavenMetadataSource.createArtifacts(..)
- * <-- InvalidDependencyVersionException
- * <-- ProjectBuildingException
- *
- */
- void reportBadDependencyVersion( MavenProject project,
- File pomFile,
- InvalidDependencyVersionException cause );
-
- /**
- * Call Stack:
- *
- *
- * ...
- * --> DefaultMavenProjectBuilder.buildFromRepository(..)
- * --> DefaultMavenProjectBuilder.findModelFromRepository(..) (private)
- * DefaultMavenProjectBuilder.build(..)
- * --> DefaultMavenProjectBuilder.buildFromSourceFileInternal(..) (private)
- * --> DefaultMavenProjectBuilder.readModel(..) (private)
- * --> thrown XmlPullParserException
- * <------ InvalidProjectModelException
- *
- */
- void reportErrorParsingProjectModel( String projectId,
- File pomFile,
- XmlPullParserException cause );
-
- /**
- * Call Stack:
- *
- *
- * ...
- * --> DefaultMavenProjectBuilder.buildFromRepository(..)
- * --> DefaultMavenProjectBuilder.findModelFromRepository(..) (private)
- * DefaultMavenProjectBuilder.build(..)
- * --> DefaultMavenProjectBuilder.buildFromSourceFileInternal(..) (private)
- * --> DefaultMavenProjectBuilder.readModel(..) (private)
- * --> thrown IOException
- * <------ InvalidProjectModelException
- *
- */
- void reportErrorParsingProjectModel( String projectId,
- File pomFile,
- IOException cause );
-
- /**
- * Call Stack:
- *
- *
- * MavenEmbedder.execute(MavenExecutionRequest)
- * MavenEmbedder.readProjectWithDependencies(MavenExecutionRequest)
- * --> DefaultMaven.execute(MavenExecutionRequest)
- * --> DefaultMaven.createReactorManager(MavenExecutionRequest, MavenExecutionResult)
- * --> new ReactorManager(List, String)
- * --> new ProjectSorter(List)
- * <----------------------- DuplicateProjectException
- *
- */
- void reportProjectCollision( List allProjectInstances,
- DuplicateProjectException err );
-}
diff --git a/maven-core/src/main/java/org/apache/maven/errors/ProjectErrorTips.java b/maven-core/src/main/java/org/apache/maven/errors/ProjectErrorTips.java
deleted file mode 100644
index 4f3682ebed..0000000000
--- a/maven-core/src/main/java/org/apache/maven/errors/ProjectErrorTips.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package org.apache.maven.errors;
-
-import org.apache.maven.artifact.InvalidRepositoryException;
-import org.apache.maven.model.Dependency;
-import org.apache.maven.model.Model;
-import org.apache.maven.model.Profile;
-import org.apache.maven.model.RepositoryBase;
-import org.apache.maven.execution.DuplicateProjectException;
-import org.apache.maven.project.InvalidProjectVersionException;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.project.validation.ModelValidationResult;
-import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
-import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-// NOTE: The strange String[] syntax is a backward adaptation from java5 stuff, where
-// I was using varargs in listOf(..). I'm not moving them to constants because I'd like
-// to go back to this someday...
-
-// TODO: Optimize the String[] instances in here to List constants, and remove listOf(..)
-public final class ProjectErrorTips
-{
-
- private ProjectErrorTips()
- {
- }
-
- public static List getTipsForActivatorLookupError( String projectId,
- File pomFile,
- Profile profile,
- ComponentLookupException cause )
- {
- return listOf( new String[]{ "If this is a custom profile activator, please ensure the activator's "
- + "artifact is present in the POM's build/extensions list.",
- "See http://maven.apache.org/pom.html#Extensions for more on build extensions.",
- "XSD location for pom.xml: http://maven.apache.org/xsd/maven-4.0.0.xsd",
- "XSD location for settings.xml: http://maven.apache.org/xsd/settings-1.0.0.xsd",
- "XSD location for profiles.xml: http://maven.apache.org/xsd/profiles-1.0.0.xsd" } );
- }
-
- public static List getTipsForErrorLoadingExternalProfilesFromFile( Model model,
- File pomFile,
- File projectDir,
- IOException cause )
- {
- String profilesXmlPath = new File( projectDir, "profiles.xml" ).getAbsolutePath();
-
- return listOf( new String[]{ "Please ensure the " + profilesXmlPath + " file exists and is readable." } );
- }
-
- public static List getTipsForErrorLoadingExternalProfilesFromFile( Model model,
- File pomFile,
- File projectDir,
- XmlPullParserException cause )
- {
- return listOf( new String[]{ "XSD location: http://maven.apache.org/xsd/profiles-1.0.0.xsd" } );
- }
-
- public static List getTipsForInvalidRepositorySpec( RepositoryBase repo,
- String projectId,
- File pomFile,
- InvalidRepositoryException cause )
- {
- return listOf( new String[]{ "See http://maven.apache.org/pom.html#Repositories for more on custom artifact repositories.",
- "See http://maven.apache.org/pom.html#PluginRepositories for more on custom plugin repositories.",
- "XSD location for pom.xml: http://maven.apache.org/xsd/maven-4.0.0.xsd",
- "XSD location for settings.xml: http://maven.apache.org/xsd/settings-1.0.0.xsd",
- "XSD location for profiles.xml: http://maven.apache.org/xsd/profiles-1.0.0.xsd" } );
- }
-
- private static List listOf( String[] tips )
- {
- List list = new ArrayList();
-
- for ( int i = 0; i < tips.length; i++ )
- {
- list.add( tips[i] );
- }
-
- return list;
- }
-
- public static List getTipsForProjectValidationFailure( MavenProject project,
- File pomFile,
- ModelValidationResult validationResult )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getTipsForBadDependencySpec( MavenProject project,
- File pomFile,
- Dependency dep )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getTipsForBadNonDependencyArtifactSpec( MavenProject project,
- File pomFile,
- InvalidProjectVersionException cause )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getTipsForPomParsingError( String projectId,
- File pomFile,
- Exception cause )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public static List getTipsForDuplicateProjectError( List allProjectInstances,
- DuplicateProjectException err )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
-}
diff --git a/maven-core/src/main/java/org/apache/maven/errors/ProjectReporterManager.java b/maven-core/src/main/java/org/apache/maven/errors/ProjectReporterManager.java
deleted file mode 100644
index b8b164682c..0000000000
--- a/maven-core/src/main/java/org/apache/maven/errors/ProjectReporterManager.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.apache.maven.errors;
-
-public final class ProjectReporterManager
-{
-
- // FIXME: This is not threadsafe!
- private static ProjectErrorReporter reporter;
-
- private ProjectReporterManager()
- {
- }
-
- public static ProjectErrorReporter getReporter()
- {
- if ( reporter == null )
- {
- reporter = new DefaultProjectErrorReporter();
- }
-
- return reporter;
- }
-
- public static void setReporter( ProjectErrorReporter instance )
- {
- reporter = instance;
- }
-
- public static void clearReporter()
- {
- reporter = null;
- }
-
-}
diff --git a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
index 1bea2b3eb1..8da93dda12 100644
--- a/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
+++ b/maven-core/src/main/java/org/apache/maven/execution/DefaultMavenExecutionRequest.java
@@ -22,7 +22,6 @@ import java.util.List;
import java.util.Properties;
import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.errors.CoreErrorReporter;
import org.apache.maven.monitor.event.EventMonitor;
import org.apache.maven.profiles.ProfileActivationContext;
import org.apache.maven.profiles.ProfileManager;
@@ -609,8 +608,6 @@ public class DefaultMavenExecutionRequest
private Settings settings;
- private CoreErrorReporter errorReporter;
-
private ProfileActivationContext profileActivationContext;
// calculated from request attributes.
@@ -713,17 +710,6 @@ public class DefaultMavenExecutionRequest
return this;
}
- public CoreErrorReporter getErrorReporter()
- {
- return errorReporter;
- }
-
- public MavenExecutionRequest setErrorReporter( CoreErrorReporter reporter )
- {
- errorReporter = reporter;
- return this;
- }
-
public ProfileActivationContext getProfileActivationContext()
{
return profileActivationContext;
diff --git a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
index 146b4115ec..3455be0f7c 100644
--- a/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
+++ b/maven-core/src/main/java/org/apache/maven/execution/MavenExecutionRequest.java
@@ -26,7 +26,6 @@ import java.util.Properties;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
-import org.apache.maven.errors.CoreErrorReporter;
import org.apache.maven.monitor.event.EventMonitor;
import org.apache.maven.profiles.ProfileActivationContext;
import org.apache.maven.profiles.ProfileManager;
@@ -227,8 +226,5 @@ public interface MavenExecutionRequest
MavenExecutionRequest clearAccumulatedBuildState();
- MavenExecutionRequest setErrorReporter( CoreErrorReporter reporter );
- CoreErrorReporter getErrorReporter();
-
ProjectBuilderConfiguration getProjectBuildingConfiguration();
}
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
index 2490ceafa7..b41be6c794 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
@@ -31,8 +31,6 @@ import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.execution.ReactorManager;
import org.apache.maven.lifecycle.mapping.LifecycleMapping;
-import org.apache.maven.lifecycle.model.LifecycleBinding;
-import org.apache.maven.lifecycle.model.LifecycleBindings;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginExecution;
import org.apache.maven.model.ReportPlugin;
@@ -69,14 +67,13 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
* @author Jason van Zyl
* @author Brett Porter
*/
-@Component(role = LifecycleExecutor.class)
public class DefaultLifecycleExecutor
extends AbstractLogEnabled
implements LifecycleExecutor
{
//@Requirement
//private getLogger() getLogger();
-
+
@Requirement
private PluginManager pluginManager;
@@ -86,25 +83,22 @@ public class DefaultLifecycleExecutor
private Map phaseToLifecycleMap;
- public List getLifecyclePhases()
+ public List getLifecyclePhases()
{
- return lifecycles;
- }
-
- public static boolean isValidPhaseName( final String phaseName )
- {
- LifecycleBindings test = new LifecycleBindings();
- for ( Iterator it = test.getBindingList().iterator(); it.hasNext(); )
+ for ( Lifecycle lifecycle : lifecycles )
{
- LifecycleBinding binding = (LifecycleBinding) it.next();
-
- if ( binding.getPhaseNamesInOrder().contains( phaseName ) )
+ if ( lifecycle.getId().equals( "default" ) )
{
- return true;
+ return lifecycle.getPhases();
}
}
- return false;
+ return null;
+ }
+
+ public static boolean isValidPhaseName( final String phaseName )
+ {
+ return true;
}
/**
@@ -133,19 +127,13 @@ public class DefaultLifecycleExecutor
return new TaskValidationResult( task, "Cannot find mojo descriptor for: \'" + task + "\' - Treating as non-aggregator.", e );
}
- catch ( LifecycleSpecificationException e )
+ catch ( LifecycleExecutionException e )
{
String message = "Invalid task '" + task + "': you must specify a valid lifecycle phase, or"
+ " a goal in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal";
return new TaskValidationResult( task, message, e );
}
- catch ( LifecycleLoaderException e )
- {
- String message = "Failed to load one or more lifecycle definitions which may contain task: '" + task + "'.";
-
- return new TaskValidationResult( task, message, e );
- }
catch ( InvalidPluginException e )
{
return new TaskValidationResult( task, e.getMessage(), e );
@@ -164,19 +152,19 @@ public class DefaultLifecycleExecutor
* @throws PluginLoaderException
*/
private MojoDescriptor getMojoDescriptorForDirectInvocation( String task, MavenSession session, MavenProject project )
- throws InvalidPluginException, LifecycleSpecificationException, LifecycleLoaderException, PluginLoaderException
- {
+ throws InvalidPluginException, PluginLoaderException, LifecycleExecutionException
+ {
MojoDescriptor descriptor;
-
+
try
{
descriptor = getMojoDescriptor( task, session, project );
}
catch ( LifecycleExecutionException e )
{
- throw new LifecycleSpecificationException( "Cannot find the specified goal.", e );
+ throw new LifecycleExecutionException( "Cannot find the specified goal.", e );
}
-
+
if ( descriptor == null )
{
throw new InvalidPluginException( "Plugin: " + descriptor.getId() + " does not contain referenced mojo: " + descriptor.getGoal() );
@@ -535,7 +523,7 @@ public class DefaultLifecycleExecutor
for ( Iterator i = goals.iterator(); i.hasNext(); )
{
MojoExecution mojoExecution = (MojoExecution) i.next();
-
+
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
if ( mojoDescriptor.getExecutePhase() != null || mojoDescriptor.getExecuteGoal() != null )
@@ -1230,23 +1218,23 @@ public class DefaultLifecycleExecutor
}
return goals;
}
-
+
MojoDescriptor getMojoDescriptor( String task, MavenSession session, MavenProject project )
throws LifecycleExecutionException
{
String goal;
Plugin plugin;
- PluginDescriptor pluginDescriptor = null;
-
+ PluginDescriptor pluginDescriptor = null;
+
StringTokenizer tok = new StringTokenizer( task, ":" );
- int numTokens = tok.countTokens();
-
+ int numTokens = tok.countTokens();
+
if ( numTokens == 2 )
{
String prefix = tok.nextToken();
goal = tok.nextToken();
-
+
// This is the case where someone has executed a single goal from the command line
// of the form:
//
@@ -1255,9 +1243,9 @@ public class DefaultLifecycleExecutor
// From the metadata stored on the server which has been created as part of a standard
// Maven plugin deployment we will find the right PluginDescriptor from the remote
// repository.
-
+
plugin = pluginManager.findPluginForPrefix( prefix, project, session );
-
+
if ( plugin == null )
{
plugin = new Plugin();
@@ -1335,7 +1323,7 @@ public class DefaultLifecycleExecutor
project.addPlugin( plugin );
MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( goal );
-
+
return mojoDescriptor;
}
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java b/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java
index e845df5abd..f85b9912f8 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/LifecycleExecutor.java
@@ -32,7 +32,7 @@ import org.apache.maven.project.MavenProject;
*/
public interface LifecycleExecutor
{
- List getLifecyclePhases();
+ List getLifecyclePhases();
TaskValidationResult isTaskValid( String task, MavenSession session, MavenProject rootProject );
diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/TaskValidationResult.java b/maven-core/src/main/java/org/apache/maven/lifecycle/TaskValidationResult.java
index 9869a73e1f..945a2ec240 100644
--- a/maven-core/src/main/java/org/apache/maven/lifecycle/TaskValidationResult.java
+++ b/maven-core/src/main/java/org/apache/maven/lifecycle/TaskValidationResult.java
@@ -28,16 +28,7 @@ public class TaskValidationResult
public TaskValidationResult( String invalidTask,
String message,
- LifecycleSpecificationException cause )
- {
- this.invalidTask = invalidTask;
- this.message = message;
- this.cause = cause;
- }
-
- public TaskValidationResult( String invalidTask,
- String message,
- LifecycleLoaderException cause )
+ LifecycleExecutionException cause )
{
this.invalidTask = invalidTask;
this.message = message;
diff --git a/maven-core/src/test/java/org/apache/maven/errors/DefaultCoreErrorReporterTest.java b/maven-core/src/test/java/org/apache/maven/errors/DefaultCoreErrorReporterTest.java
deleted file mode 100644
index 71b8fcf14e..0000000000
--- a/maven-core/src/test/java/org/apache/maven/errors/DefaultCoreErrorReporterTest.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.apache.maven.errors;
-
-import org.apache.maven.InvalidTaskException;
-import org.apache.maven.lifecycle.TaskValidationResult;
-import org.apache.maven.plugin.InvalidPluginException;
-
-import junit.framework.TestCase;
-
-public class DefaultCoreErrorReporterTest
- extends TestCase
-{
-
- public void testReportInvalidPluginForDirectInvocation()
- {
- CoreErrorReporter reporter = new DefaultCoreErrorReporter();
-
- InvalidPluginException err = new InvalidPluginException( "Test message" );
- reporter.reportInvalidPluginForDirectInvocation( "test", null, null, err );
-
- TaskValidationResult tvr = new TaskValidationResult( "test", "This is a test invalid task.", err );
- InvalidTaskException exception = tvr.generateInvalidTaskException();
-
- Throwable realCause = reporter.findReportedException( exception );
-
- assertSame( err, realCause );
-
- String message = reporter.getFormattedMessage( realCause );
-
- System.out.println( message );
-
- assertNotNull( message );
- assertTrue( message.length() > 0 );
- }
-
-}
diff --git a/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java b/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java
index 1b0499d7bd..ec30defe3c 100644
--- a/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java
+++ b/maven-core/src/test/java/org/apache/maven/lifecycle/LifecycleExecutorTest.java
@@ -8,8 +8,6 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenSession;
-import org.apache.maven.model.Plugin;
-import org.apache.maven.model.PluginExecution;
import org.apache.maven.model.Repository;
import org.apache.maven.plugin.MavenPluginCollector;
import org.apache.maven.plugin.MavenPluginDiscoverer;
@@ -29,7 +27,6 @@ import org.codehaus.plexus.PlexusTestCase;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.logging.console.ConsoleLogger;
import org.codehaus.plexus.util.FileUtils;
-import org.codehaus.plexus.util.xml.Xpp3Dom;
public class LifecycleExecutorTest
extends PlexusTestCase
@@ -56,6 +53,11 @@ public class LifecycleExecutorTest
lifecycleExecutor = (DefaultLifecycleExecutor) lookup( LifecycleExecutor.class );
}
+ public void testLifecyclePhases()
+ {
+ assertNotNull( lifecycleExecutor.getLifecyclePhases() );
+ }
+
public void testMojoExecution()
throws Exception
{
@@ -112,31 +114,7 @@ public class LifecycleExecutorTest
assertEquals( "1.0", pd.getVersion() );
MojoExecution me = new MojoExecution( mojoDescriptor );
-
-// for ( Plugin bp : project.getBuildPlugins() )
-// {
-// // The POM builder should have merged any configuration at the upper level of the plugin
-// // element with the execution level configuration where our goal is.
-//
-// // We have our plugin
-// if ( bp.getArtifactId().equals( pd.getArtifactId() ) )
-// {
-// // Search through executions
-// for( PluginExecution e : bp.getExecutions() )
-// {
-// // Search though goals to match what's been asked for.
-// for ( String g : e.getGoals() )
-// {
-// // This goal matches what's been asked for.
-// if( g.equals( goal ) )
-// {
-// me.setConfiguration( (Xpp3Dom) e.getConfiguration() );
-// }
-// }
-// }
-// }
-// }
-
+
// Need some xpath action in here. Make sure the mojoExecution configuration is intact
// Now the magical mojo descriptor is complete and I can execute the mojo.
diff --git a/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java b/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java
index b85ee086c2..289598d8a5 100644
--- a/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java
+++ b/maven-embedder/src/main/java/org/apache/maven/cli/CLIReportingUtils.java
@@ -12,8 +12,6 @@ import java.util.TimeZone;
import org.apache.maven.ProjectBuildFailureException;
import org.apache.maven.embedder.MavenEmbedderConsoleLogger;
import org.apache.maven.embedder.MavenEmbedderLogger;
-import org.apache.maven.errors.CoreErrorReporter;
-import org.apache.maven.errors.DefaultCoreErrorReporter;
import org.apache.maven.execution.ApplicationInformation;
import org.apache.maven.execution.DefaultRuntimeInformation;
import org.apache.maven.execution.MavenExecutionRequest;
@@ -85,7 +83,7 @@ public final class CLIReportingUtils
{
Exception e = (Exception) i.next();
- showError( e, request.isShowErrors(), request.getErrorReporter(), logger );
+ showError( e, request.isShowErrors(), logger );
}
line( logger );
@@ -133,7 +131,7 @@ public final class CLIReportingUtils
{
MavenEmbedderLogger logger = new MavenEmbedderConsoleLogger();
- showError( message, e, showErrors, new DefaultCoreErrorReporter(), logger );
+ showError( message, e, showErrors, logger );
if ( !showErrors )
{
@@ -141,9 +139,9 @@ public final class CLIReportingUtils
}
}
- private static void showError( Exception e, boolean show, CoreErrorReporter reporter, MavenEmbedderLogger logger )
+ private static void showError( Exception e, boolean show, MavenEmbedderLogger logger )
{
- showError( null, e, show, reporter, logger );
+ showError( null, e, show, logger );
}
/**
@@ -155,7 +153,7 @@ public final class CLIReportingUtils
* @param logger
*/
//mkleint: public because used in netbeans integration
- public static void showError( String message, Exception e, boolean showStackTraces, CoreErrorReporter reporter, MavenEmbedderLogger logger )
+ public static void showError( String message, Exception e, boolean showStackTraces, MavenEmbedderLogger logger )
{
StringWriter writer = new StringWriter();
@@ -167,7 +165,7 @@ public final class CLIReportingUtils
writer.write( NEWLINE );
}
- buildErrorMessage( e, showStackTraces, reporter, writer );
+ buildErrorMessage( e, showStackTraces, writer );
writer.write( NEWLINE );
@@ -182,34 +180,8 @@ public final class CLIReportingUtils
logger.error( writer.toString() );
}
- public static void buildErrorMessage( Exception e, boolean showStackTraces, CoreErrorReporter reporter, StringWriter writer )
- {
- if ( reporter != null )
- {
- Throwable reported = reporter.findReportedException( e );
-
- if ( reported != null )
- {
- writer.write( reporter.getFormattedMessage( reported ) );
-
- if ( showStackTraces )
- {
- writer.write( NEWLINE );
- writer.write( NEWLINE );
- Throwable cause = reporter.getRealCause( reported );
- if ( cause != null )
- {
- cause.printStackTrace( new PrintWriter( writer ) );
- }
- }
-
- writer.write( NEWLINE );
- writer.write( NEWLINE );
-
- return;
- }
- }
-
+ public static void buildErrorMessage( Exception e, boolean showStackTraces, StringWriter writer )
+ {
boolean handled = false;
if ( e instanceof ProjectBuildingException )
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 b418390c40..67e6553dd4 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
@@ -19,6 +19,8 @@ package org.apache.maven.cli;
* under the License.
*/
+import java.io.File;
+
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.ParseException;
import org.apache.maven.embedder.Configuration;
@@ -29,13 +31,10 @@ import org.apache.maven.embedder.MavenEmbedderConsoleLogger;
import org.apache.maven.embedder.MavenEmbedderException;
import org.apache.maven.embedder.MavenEmbedderFileLogger;
import org.apache.maven.embedder.MavenEmbedderLogger;
-import org.apache.maven.errors.DefaultCoreErrorReporter;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionResult;
import org.codehaus.plexus.classworlds.ClassWorld;
-import java.io.File;
-
/**
* @author jason van zyl
* @noinspection UseOfSystemOutOrSystemErr,ACCESS_STATIC_VIA_INSTANCE
@@ -203,7 +202,6 @@ public class MavenCli
}
Configuration configuration = new DefaultConfiguration()
- .setErrorReporter( new DefaultCoreErrorReporter() )
.setUserSettingsFile( userSettingsFile )
.setGlobalSettingsFile( globalSettingsFile )
.setClassWorld( classWorld );
diff --git a/maven-embedder/src/main/java/org/apache/maven/embedder/Configuration.java b/maven-embedder/src/main/java/org/apache/maven/embedder/Configuration.java
index 88b3c7deeb..7a0360478b 100644
--- a/maven-embedder/src/main/java/org/apache/maven/embedder/Configuration.java
+++ b/maven-embedder/src/main/java/org/apache/maven/embedder/Configuration.java
@@ -18,17 +18,16 @@ package org.apache.maven.embedder;
* under the License.
*/
-import org.apache.maven.errors.CoreErrorReporter;
-import org.apache.maven.monitor.event.EventMonitor;
-import org.apache.maven.realm.MavenRealmManager;
-import org.codehaus.plexus.PlexusContainer;
-import org.codehaus.plexus.classworlds.ClassWorld;
-
import java.io.File;
import java.net.URL;
import java.util.List;
import java.util.Properties;
+import org.apache.maven.monitor.event.EventMonitor;
+import org.apache.maven.realm.MavenRealmManager;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.classworlds.ClassWorld;
+
/**
* Configuration of embedder, used when starting up.
*
@@ -134,14 +133,6 @@ public interface Configuration
MavenRealmManager getRealmManager();
- // ----------------------------------------------------------------------------
- // Error Reporter
- // ----------------------------------------------------------------------------
-
- Configuration setErrorReporter( CoreErrorReporter errorReporter );
-
- CoreErrorReporter getErrorReporter();
-
// ----------------------------------------------------------------------------
// Event Monitors
// ----------------------------------------------------------------------------
diff --git a/maven-embedder/src/main/java/org/apache/maven/embedder/DefaultConfiguration.java b/maven-embedder/src/main/java/org/apache/maven/embedder/DefaultConfiguration.java
index 4882794d20..532b3dc891 100644
--- a/maven-embedder/src/main/java/org/apache/maven/embedder/DefaultConfiguration.java
+++ b/maven-embedder/src/main/java/org/apache/maven/embedder/DefaultConfiguration.java
@@ -18,18 +18,17 @@ package org.apache.maven.embedder;
* under the License.
*/
-import org.apache.maven.errors.CoreErrorReporter;
-import org.apache.maven.monitor.event.EventMonitor;
-import org.apache.maven.realm.MavenRealmManager;
-import org.codehaus.plexus.PlexusContainer;
-import org.codehaus.plexus.classworlds.ClassWorld;
-
import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
+import org.apache.maven.monitor.event.EventMonitor;
+import org.apache.maven.realm.MavenRealmManager;
+import org.codehaus.plexus.PlexusContainer;
+import org.codehaus.plexus.classworlds.ClassWorld;
+
/**
* Default implementation of Configuration intefrace.
*
@@ -62,8 +61,6 @@ public class DefaultConfiguration
private MavenRealmManager realmManager;
- private CoreErrorReporter errorReporter;
-
private List eventMonitors;
/** Creates a new instance of DefaultConfiguration */
@@ -238,17 +235,6 @@ public class DefaultConfiguration
return this;
}
- public CoreErrorReporter getErrorReporter()
- {
- return errorReporter;
- }
-
- public Configuration setErrorReporter( CoreErrorReporter errorReporter )
- {
- this.errorReporter = errorReporter;
- return this;
- }
-
public Configuration addEventMonitor( EventMonitor eventMonitor )
{
if ( eventMonitors == null )
diff --git a/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java b/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java
index 533ba22bdb..4f6a6826fb 100644
--- a/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java
+++ b/maven-embedder/src/main/java/org/apache/maven/embedder/MavenEmbedder.java
@@ -23,42 +23,28 @@ import java.io.File;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
-import java.net.URL;
import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
import java.util.List;
import org.apache.maven.Maven;
import org.apache.maven.artifact.repository.ArtifactRepository;
-import org.apache.maven.artifact.resolver.ArtifactNotFoundException;
-import org.apache.maven.artifact.resolver.ArtifactResolutionException;
import org.apache.maven.embedder.execution.MavenExecutionRequestPopulator;
-import org.apache.maven.errors.CoreErrorReporter;
-import org.apache.maven.errors.CoreReporterManager;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.DefaultMavenExecutionResult;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionResult;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.execution.ReactorManager;
-import org.apache.maven.lifecycle.LifecycleUtils;
import org.apache.maven.model.Model;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
import org.apache.maven.monitor.event.DefaultEventDispatcher;
import org.apache.maven.monitor.event.EventDispatcher;
-import org.apache.maven.plugin.InvalidPluginException;
import org.apache.maven.plugin.MavenPluginCollector;
import org.apache.maven.plugin.MavenPluginDiscoverer;
-import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.PluginLoaderException;
import org.apache.maven.plugin.PluginManager;
-import org.apache.maven.plugin.PluginManagerException;
-import org.apache.maven.plugin.PluginNotFoundException;
-import org.apache.maven.plugin.PluginVersionNotFoundException;
-import org.apache.maven.plugin.PluginVersionResolutionException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectBuilder;
import org.apache.maven.project.MavenProjectBuildingResult;
@@ -81,11 +67,7 @@ import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.PlexusContainerException;
import org.codehaus.plexus.classworlds.ClassWorld;
import org.codehaus.plexus.classworlds.realm.ClassRealm;
-import org.codehaus.plexus.classworlds.realm.DuplicateRealmException;
-import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
-import org.codehaus.plexus.component.repository.exception.ComponentRepositoryException;
-import org.codehaus.plexus.configuration.PlexusConfigurationException;
import org.codehaus.plexus.logging.LoggerManager;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.ReaderFactory;
@@ -314,11 +296,6 @@ public class MavenEmbedder
public MavenProject readProject( File mavenProject )
throws ProjectBuildingException, MavenExecutionException
{
- CoreErrorReporter errorReporter = request.getErrorReporter();
- errorReporter.clearErrors();
-
- CoreReporterManager.setReporter( errorReporter );
-
return readProject( mavenProject, request );
}
@@ -343,11 +320,6 @@ public class MavenEmbedder
{
request = populator.populateDefaults( request, configuration );
- CoreErrorReporter errorReporter = request.getErrorReporter();
- errorReporter.clearErrors();
-
- CoreReporterManager.setReporter( errorReporter );
-
readProject( request.getPom(), request );
}
catch ( MavenEmbedderException e )
@@ -374,9 +346,7 @@ public class MavenEmbedder
try
{
- projectBuildingResult = mavenProjectBuilder.buildProjectWithDependencies(
- request.getPom(),
- request.getProjectBuildingConfiguration() );
+ projectBuildingResult = mavenProjectBuilder.buildProjectWithDependencies( request.getPom(), request.getProjectBuildingConfiguration() );
}
catch ( ProjectBuildingException e )
{
@@ -409,21 +379,6 @@ public class MavenEmbedder
return result;
}
- // ----------------------------------------------------------------------
- // Lifecycle information
- // ----------------------------------------------------------------------
-
- public List getLifecyclePhases()
- {
- return getBuildLifecyclePhases();
- }
-
-
- public List getBuildLifecyclePhases()
- {
- return LifecycleUtils.getValidBuildPhaseNames();
- }
-
// ----------------------------------------------------------------------
// Lifecycle
// ----------------------------------------------------------------------
@@ -644,11 +599,6 @@ public class MavenEmbedder
return result;
}
- CoreErrorReporter errorReporter = request.getErrorReporter();
- errorReporter.clearErrors();
-
- CoreReporterManager.setReporter( errorReporter );
-
return maven.execute( request );
}
finally
@@ -666,4 +616,9 @@ public class MavenEmbedder
{
return container;
}
+
+ public List getLifecyclePhases()
+ {
+ return maven.getLifecyclePhases();
+ }
}
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 df747f1c7c..175d0d0137 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
@@ -17,7 +17,6 @@ package org.apache.maven.embedder.execution;
import java.io.File;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
@@ -30,7 +29,6 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.embedder.Configuration;
import org.apache.maven.embedder.MavenEmbedder;
import org.apache.maven.embedder.MavenEmbedderException;
-import org.apache.maven.errors.DefaultCoreErrorReporter;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.model.Profile;
import org.apache.maven.model.Repository;
@@ -87,8 +85,6 @@ public class DefaultMavenExecutionRequestPopulator
{
eventing( request, configuration );
- reporter( request, configuration );
-
executionProperties( request, configuration );
pom( request, configuration );
@@ -108,21 +104,6 @@ public class DefaultMavenExecutionRequestPopulator
return request;
}
- private void reporter( MavenExecutionRequest request, Configuration configuration )
- {
- if ( request.getErrorReporter() == null )
- {
- if ( configuration.getErrorReporter() != null )
- {
- request.setErrorReporter( configuration.getErrorReporter() );
- }
- else
- {
- request.setErrorReporter( new DefaultCoreErrorReporter() );
- }
- }
- }
-
private void executionProperties( MavenExecutionRequest request, Configuration configuration )
{
Properties requestProperties = request.getProperties();
diff --git a/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java b/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java
index 6e6c61cbec..5cdcff4f12 100644
--- a/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java
+++ b/maven-embedder/src/test/java/org/apache/maven/embedder/MavenEmbedderTest.java
@@ -19,6 +19,17 @@ package org.apache.maven.embedder;
* under the License.
*/
+import java.io.File;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import junit.framework.TestCase;
+
import org.apache.maven.artifact.Artifact;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionRequest;
@@ -33,24 +44,12 @@ import org.apache.maven.settings.Settings;
import org.apache.maven.settings.SettingsConfigurationException;
import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader;
import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer;
-import org.apache.maven.lifecycle.LifecycleSpecificationException;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.IOUtil;
import org.codehaus.plexus.util.ReaderFactory;
import org.codehaus.plexus.util.WriterFactory;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
-import java.io.File;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import junit.framework.TestCase;
-
public class MavenEmbedderTest
extends TestCase
{
@@ -301,7 +300,7 @@ public class MavenEmbedderTest
throws Exception
{
List phases = maven.getLifecyclePhases();
-
+
assertEquals( "validate", (String) phases.get( 0 ) );
assertEquals( "initialize", (String) phases.get( 1 ) );