junit
diff --git a/maven-embedder/src/test/error-reporting-projects/testReportProjectValidationFailure/pom.xml b/maven-embedder/src/test/error-reporting-projects/testReportProjectValidationFailure/pom.xml
new file mode 100644
index 0000000000..4e27c4d17c
--- /dev/null
+++ b/maven-embedder/src/test/error-reporting-projects/testReportProjectValidationFailure/pom.xml
@@ -0,0 +1,13 @@
+
+ 4.0.0
+ org.apache.maven.errortest
+ testReportProjectValidationFailure
+ 1
+
+
+
+ junit
+ junit
+
+
+
\ No newline at end of file
diff --git a/maven-embedder/src/test/java/org/apache/maven/error/DummyCoreErrorReporter.java b/maven-embedder/src/test/java/org/apache/maven/error/DummyCoreErrorReporter.java
new file mode 100644
index 0000000000..9d844abb7f
--- /dev/null
+++ b/maven-embedder/src/test/java/org/apache/maven/error/DummyCoreErrorReporter.java
@@ -0,0 +1,603 @@
+package org.apache.maven.error;
+
+import org.apache.maven.NoGoalsSpecifiedException;
+import org.apache.maven.ProjectCycleException;
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.artifact.InvalidRepositoryException;
+import org.apache.maven.artifact.UnknownRepositoryLayoutException;
+import org.apache.maven.artifact.metadata.ArtifactMetadataRetrievalException;
+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.artifact.resolver.ArtifactResolutionResult;
+import org.apache.maven.artifact.versioning.ArtifactVersion;
+import org.apache.maven.artifact.versioning.InvalidVersionSpecificationException;
+import org.apache.maven.errors.DefaultCoreErrorReporter;
+import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.execution.RealmManagementException;
+import org.apache.maven.extension.ExtensionManagerException;
+import org.apache.maven.lifecycle.LifecycleException;
+import org.apache.maven.lifecycle.LifecycleExecutionException;
+import org.apache.maven.lifecycle.LifecycleLoaderException;
+import org.apache.maven.lifecycle.LifecycleSpecificationException;
+import org.apache.maven.lifecycle.TaskValidationResult;
+import org.apache.maven.lifecycle.model.MojoBinding;
+import org.apache.maven.model.DeploymentRepository;
+import org.apache.maven.model.Model;
+import org.apache.maven.model.Parent;
+import org.apache.maven.model.Plugin;
+import org.apache.maven.model.Profile;
+import org.apache.maven.model.Repository;
+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.PluginManagerException;
+import org.apache.maven.plugin.PluginNotFoundException;
+import org.apache.maven.plugin.PluginParameterException;
+import org.apache.maven.plugin.descriptor.Parameter;
+import org.apache.maven.plugin.loader.PluginLoaderException;
+import org.apache.maven.plugin.version.PluginVersionNotFoundException;
+import org.apache.maven.plugin.version.PluginVersionResolutionException;
+import org.apache.maven.profiles.activation.ProfileActivationContext;
+import org.apache.maven.profiles.activation.ProfileActivationException;
+import org.apache.maven.profiles.activation.ProfileActivator;
+import org.apache.maven.project.DuplicateProjectException;
+import org.apache.maven.project.InvalidProjectModelException;
+import org.apache.maven.project.InvalidProjectVersionException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.project.ProjectBuildingException;
+import org.apache.maven.project.artifact.InvalidDependencyVersionException;
+import org.apache.maven.project.build.model.ModelAndFile;
+import org.apache.maven.project.interpolation.ModelInterpolationException;
+import org.apache.maven.project.path.PathTranslator;
+import org.apache.maven.reactor.MavenExecutionException;
+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 org.codehaus.plexus.util.xml.pull.XmlPullParserException;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+
+public class DummyCoreErrorReporter
+ extends DefaultCoreErrorReporter
+{
+
+ public void handleSuperPomBuildingError( ProjectBuildingException exception )
+ {
+
+
+ }
+
+ public void reportAggregatedMojoFailureException( MavenSession session,
+ MojoBinding binding,
+ MojoFailureException cause )
+ {
+
+
+ }
+
+ public void reportAttemptToOverrideUneditableMojoParameter( Parameter currentParameter,
+ MojoBinding binding,
+ MavenProject project,
+ MavenSession session,
+ MojoExecution exec,
+ PathTranslator translator,
+ Logger logger,
+ PluginConfigurationException cause )
+ {
+
+
+ }
+
+ public void reportErrorApplyingMojoConfiguration( MojoBinding binding,
+ MavenProject project,
+ PlexusConfiguration config,
+ PluginConfigurationException cause )
+ {
+
+
+ }
+
+ public void reportErrorConfiguringExtensionPluginRealm( Plugin plugin,
+ Model originModel,
+ List remoteRepos,
+ MavenExecutionRequest request,
+ PluginManagerException cause )
+ {
+
+
+ }
+
+ public void reportErrorFormulatingBuildPlan( List tasks,
+ MavenProject configuringProject,
+ String targetDescription,
+ LifecycleException cause )
+ {
+
+
+ }
+
+ public void reportErrorInterpolatingModel( Model model,
+ Map inheritedValues,
+ File pomFile,
+ MavenExecutionRequest request,
+ ModelInterpolationException cause )
+ {
+
+
+ }
+
+ public void reportErrorLoadingPlugin( MojoBinding binding,
+ MavenProject project,
+ PluginLoaderException cause )
+ {
+
+
+ }
+
+ public void reportErrorManagingRealmForExtension( Artifact extensionArtifact,
+ Artifact projectArtifact,
+ List remoteRepos,
+ MavenExecutionRequest request,
+ RealmManagementException cause )
+ {
+
+
+ }
+
+ public void reportErrorManagingRealmForExtensionPlugin( Plugin plugin,
+ Model originModel,
+ List remoteRepos,
+ MavenExecutionRequest request,
+ RealmManagementException cause )
+ {
+
+
+ }
+
+ public void reportErrorResolvingExtensionDependencies( Artifact extensionArtifact,
+ Artifact projectArtifact,
+ List remoteRepos,
+ MavenExecutionRequest request,
+ ArtifactResolutionResult resolutionResult,
+ ExtensionManagerException err )
+ {
+
+
+ }
+
+ public void reportErrorResolvingExtensionDirectDependencies( Artifact extensionArtifact,
+ Artifact projectArtifact,
+ List remoteRepos,
+ MavenExecutionRequest request,
+ ArtifactMetadataRetrievalException cause )
+ {
+
+
+ }
+
+ public void reportErrorSearchingforCompatibleExtensionPluginVersion( Plugin plugin,
+ Model originModel,
+ List remoteRepos,
+ MavenExecutionRequest request,
+ String requiredMavenVersion,
+ String currentMavenVersion,
+ InvalidVersionSpecificationException cause )
+ {
+
+
+ }
+
+ public void reportExtensionPluginArtifactNotFound( Plugin plugin,
+ Model originModel,
+ List remoteRepos,
+ MavenExecutionRequest request,
+ PluginNotFoundException cause )
+ {
+
+
+ }
+
+ public void reportExtensionPluginVersionNotFound( Plugin plugin,
+ Model originModel,
+ List remoteRepos,
+ MavenExecutionRequest request,
+ PluginVersionNotFoundException cause )
+ {
+
+
+ }
+
+ public void reportIncompatibleMavenVersionForExtensionPlugin( Plugin plugin,
+ Model originModel,
+ List remoteRepos,
+ MavenExecutionRequest request,
+ String requiredMavenVersion,
+ String currentMavenVersion,
+ PluginVersionResolutionException err )
+ {
+
+
+ }
+
+ public void reportInvalidDependencyVersionInExtensionPluginPOM( Plugin plugin,
+ Model originModel,
+ List remoteRepos,
+ MavenExecutionRequest request,
+ InvalidDependencyVersionException cause )
+ {
+
+
+ }
+
+ public void reportInvalidMavenVersion( MavenProject project,
+ ArtifactVersion mavenVersion,
+ MavenExecutionException err )
+ {
+
+
+ }
+
+ public void reportInvalidPluginExecutionEnvironment( MojoBinding binding,
+ MavenProject project,
+ PluginExecutionException cause )
+ {
+
+
+ }
+
+ public void reportLifecycleLoaderErrorWhileValidatingTask( MavenSession session,
+ MavenProject rootProject,
+ LifecycleLoaderException cause,
+ TaskValidationResult result )
+ {
+
+
+ }
+
+ public void reportLifecycleSpecErrorWhileValidatingTask( MavenSession session,
+ MavenProject rootProject,
+ LifecycleSpecificationException cause,
+ TaskValidationResult result )
+ {
+
+
+ }
+
+ public void reportMissingArtifactWhileAddingExtensionPlugin( Plugin plugin,
+ Model originModel,
+ List remoteRepos,
+ MavenExecutionRequest request,
+ ArtifactNotFoundException cause )
+ {
+
+
+ }
+
+ public void reportMissingPluginDescriptor( MojoBinding binding,
+ MavenProject project,
+ LifecycleExecutionException err )
+ {
+
+
+ }
+
+ public void reportMissingRequiredMojoParameter( MojoBinding binding,
+ MavenProject project,
+ List invalidParameters,
+ PluginParameterException err )
+ {
+
+
+ }
+
+ public void reportMojoExecutionException( MojoBinding binding,
+ MavenProject project,
+ MojoExecutionException cause )
+ {
+
+
+ }
+
+ public void reportMojoLookupError( MojoBinding binding,
+ MavenProject project,
+ ComponentLookupException cause )
+ {
+
+
+ }
+
+ public void reportNoGoalsSpecifiedException( MavenProject rootProject,
+ NoGoalsSpecifiedException error )
+ {
+
+
+ }
+
+ public void reportPluginErrorWhileValidatingTask( MavenSession session,
+ MavenProject rootProject,
+ PluginLoaderException cause,
+ TaskValidationResult result )
+ {
+
+
+ }
+
+ public void reportPomFileCanonicalizationError( File pomFile,
+ IOException cause )
+ {
+
+
+ }
+
+ public void reportPomFileScanningError( File basedir,
+ String includes,
+ String excludes,
+ IOException cause )
+ {
+
+
+ }
+
+ public void reportProjectCycle( ProjectCycleException error )
+ {
+
+
+ }
+
+ public void reportProjectDependenciesNotFound( MavenProject project,
+ String scope,
+ ArtifactNotFoundException cause )
+ {
+
+
+ }
+
+ public void reportProjectDependenciesUnresolvable( MavenProject project,
+ String scope,
+ ArtifactResolutionException cause )
+ {
+
+
+ }
+
+ public void reportProjectDependencyArtifactNotFound( MavenProject project,
+ Artifact artifact,
+ ArtifactNotFoundException cause )
+ {
+
+
+ }
+
+ public void reportProjectDependencyArtifactUnresolvable( MavenProject project,
+ Artifact artifact,
+ ArtifactResolutionException cause )
+ {
+
+
+ }
+
+ public void reportProjectMojoFailureException( MavenSession session,
+ MojoBinding binding,
+ MojoFailureException cause )
+ {
+
+
+ }
+
+ public void reportReflectionErrorWhileEvaluatingMojoParameter( Parameter currentParameter,
+ MojoBinding binding,
+ MavenProject project,
+ String expression,
+ Exception cause )
+ {
+
+
+ }
+
+ public void reportUnresolvableArtifactWhileAddingExtensionPlugin( Plugin plugin,
+ Model originModel,
+ List remoteRepos,
+ MavenExecutionRequest request,
+ ArtifactResolutionException cause )
+ {
+
+
+ }
+
+ public void reportUnresolvableExtensionPluginPOM( Plugin plugin,
+ Model originModel,
+ List remoteRepos,
+ MavenExecutionRequest request,
+ ArtifactMetadataRetrievalException cause )
+ {
+
+
+ }
+
+ public void reportUseOfBannedMojoParameter( Parameter currentParameter,
+ MojoBinding binding,
+ MavenProject project,
+ String expression,
+ String altExpression,
+ ExpressionEvaluationException err )
+ {
+
+
+ }
+
+ public void reportActivatorError( ProfileActivator activator,
+ String projectId,
+ File pomFile,
+ Profile profile,
+ ProfileActivationContext context,
+ ProfileActivationException cause )
+ {
+
+
+ }
+
+ public void reportActivatorLookupError( String projectId,
+ File pomFile,
+ Profile profile,
+ ComponentLookupException cause )
+ {
+
+
+ }
+
+ public void reportBadDependencyVersion( MavenProject project,
+ File pomFile,
+ InvalidDependencyVersionException cause )
+ {
+
+
+ }
+
+ public void reportBadManagedDependencyVersion( MavenProject projectBeingBuilt,
+ File pomFile,
+ InvalidDependencyVersionException cause )
+ {
+
+
+ }
+
+ public void reportBadNonDependencyProjectArtifactVersion( MavenProject project,
+ File pomFile,
+ InvalidProjectVersionException cause )
+ {
+
+
+ }
+
+ public void reportErrorCreatingArtifactRepository( MavenProject project,
+ File pomFile,
+ Repository repo,
+ UnknownRepositoryLayoutException cause,
+ boolean isPluginRepo )
+ {
+
+
+ }
+
+ public void reportErrorCreatingDeploymentArtifactRepository( MavenProject project,
+ File pomFile,
+ DeploymentRepository repo,
+ UnknownRepositoryLayoutException cause )
+ {
+
+
+ }
+
+ public void reportErrorInterpolatingModel( MavenProject project,
+ File pomFile,
+ ModelInterpolationException cause )
+ {
+
+
+ }
+
+ public void reportErrorLoadingExternalProfilesFromFile( Model model,
+ File pomFile,
+ File projectDir,
+ IOException cause )
+ {
+
+
+ }
+
+ public void reportErrorLoadingExternalProfilesFromFile( Model model,
+ File pomFile,
+ File projectDir,
+ XmlPullParserException cause )
+ {
+
+
+ }
+
+ public void reportErrorParsingParentProjectModel( ModelAndFile childInfo,
+ File parentPomFile,
+ XmlPullParserException cause )
+ {
+
+
+ }
+
+ public void reportErrorParsingParentProjectModel( ModelAndFile childInfo,
+ File parentPomFile,
+ IOException cause )
+ {
+
+
+ }
+
+ public void reportErrorParsingProjectModel( String projectId,
+ File pomFile,
+ XmlPullParserException cause )
+ {
+
+
+ }
+
+ public void reportErrorParsingProjectModel( String projectId,
+ File pomFile,
+ IOException cause )
+ {
+
+
+ }
+
+ public void reportInvalidRepositoryWhileGettingRepositoriesFromProfiles( Repository repo,
+ String projectId,
+ File pomFile,
+ InvalidRepositoryException cause )
+ {
+
+
+ }
+
+ public void reportParentPomArtifactNotFound( Parent parentRef,
+ ArtifactRepository localRepo,
+ List remoteRepos,
+ String childId,
+ File childPomFile,
+ ArtifactNotFoundException cause )
+ {
+
+
+ }
+
+ public void reportParentPomArtifactUnresolvable( Parent parentRef,
+ ArtifactRepository localRepo,
+ List remoteRepos,
+ String childId,
+ File childPomFile,
+ ArtifactResolutionException cause )
+ {
+
+
+ }
+
+ public void reportProjectCollision( List allProjectInstances,
+ DuplicateProjectException err )
+ {
+
+
+ }
+
+ public void reportProjectValidationFailure( MavenProject project,
+ File pomFile,
+ InvalidProjectModelException error )
+ {
+
+
+ }
+
+}
diff --git a/maven-embedder/src/test/java/org/apache/maven/error/ErrorReporterPointcutTest.java b/maven-embedder/src/test/java/org/apache/maven/error/ErrorReporterPointcutTest.java
index a566fa66f4..2808626afd 100644
--- a/maven-embedder/src/test/java/org/apache/maven/error/ErrorReporterPointcutTest.java
+++ b/maven-embedder/src/test/java/org/apache/maven/error/ErrorReporterPointcutTest.java
@@ -1,5 +1,10 @@
package org.apache.maven.error;
+import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpConnectionManager;
+import org.apache.commons.httpclient.HttpException;
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.maven.embedder.Configuration;
import org.apache.maven.embedder.DefaultConfiguration;
import org.apache.maven.embedder.MavenEmbedder;
@@ -7,6 +12,8 @@ import org.apache.maven.embedder.MavenEmbedderConsoleLogger;
import org.apache.maven.errors.CoreErrorReporter;
import org.apache.maven.execution.DefaultMavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionRequest;
+import org.apache.maven.execution.MavenExecutionResult;
+import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
import org.codehaus.plexus.logging.Logger;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
@@ -14,8 +21,12 @@ import org.easymock.MockControl;
import java.io.File;
import java.io.IOException;
+import java.io.PrintWriter;
+import java.io.StringWriter;
import java.net.URISyntaxException;
import java.util.Arrays;
+import java.util.Collections;
+import java.util.Iterator;
import junit.framework.TestCase;
@@ -31,6 +42,10 @@ public class ErrorReporterPointcutTest
private String basedir;
+ private static boolean isOffline;
+
+ private static boolean offlineIsSet = false;
+
public void setUp()
throws Exception
{
@@ -57,10 +72,68 @@ public class ErrorReporterPointcutTest
maven = new MavenEmbedder( configuration );
}
+ private boolean checkOnline()
+ {
+ if ( !offlineIsSet )
+ {
+ HttpClient client = new HttpClient();
+ GetMethod get = new GetMethod(
+ "http://repo1.maven.org/maven2/org/apache/maven/maven-core/2.0/maven-core-2.0.pom" );
+
+ HttpConnectionManager mgr = client.getHttpConnectionManager();
+ mgr.getParams().setConnectionTimeout( 1 );
+
+ try
+ {
+ int result = client.executeMethod( get );
+ if ( result == HttpStatus.SC_OK )
+ {
+ new MavenXpp3Reader().read( get.getResponseBodyAsStream() );
+ isOffline = false;
+ }
+ }
+ catch ( HttpException e )
+ {
+ System.out.println( "System is offline" );
+ isOffline = true;
+ }
+ catch ( IOException e )
+ {
+ System.out.println( "System is offline" );
+ isOffline = true;
+ }
+ catch ( XmlPullParserException e )
+ {
+ System.out.println( "System is offline" );
+ isOffline = true;
+ }
+ finally
+ {
+ offlineIsSet = true;
+ }
+ }
+
+ if ( isOffline )
+ {
+ String method = getTestMethodName();
+ System.out.println( "Test: " + method
+ + " requires an access to the Maven central repository. SKIPPING." );
+ return false;
+ }
+
+ return true;
+ }
+
+ private String getTestMethodName()
+ {
+ String method = new Throwable().getStackTrace()[2].getMethodName();
+ return method;
+ }
+
private File prepareProjectDir()
throws URISyntaxException, IOException
{
- String method = new Throwable().getStackTrace()[1].getMethodName();
+ String method = getTestMethodName();
String resource = "error-reporting-projects/" + method;
@@ -74,8 +147,9 @@ public class ErrorReporterPointcutTest
{
FileUtils.deleteDirectory( targetDirectory );
}
- catch( IOException e )
- {}
+ catch ( IOException e )
+ {
+ }
}
FileUtils.copyDirectoryStructure( testDirectory, targetDirectory );
@@ -108,10 +182,69 @@ public class ErrorReporterPointcutTest
}
+ // FIXME: Fix the offline detection for this one!
public void testReportAggregatedMojoFailureException()
+ throws URISyntaxException, IOException
{
- // TODO Auto-generated method stub
+ if ( !checkOnline() )
+ {
+ return;
+ }
+ File projectDir = prepareProjectDir();
+
+ buildTestAccessory( new File( projectDir, "plugin" ) );
+
+ File basedir = new File( projectDir, "project" );
+
+ reporter.reportAggregatedMojoFailureException( null, null, null );
+ reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
+ reporterCtl.setVoidCallable();
+
+ reporterCtl.replay();
+
+ MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( basedir )
+ .setShowErrors( true )
+ .setErrorReporter( reporter )
+ .setGoals( Arrays.asList( new String[] {
+ "org.apache.maven.errortest:testReportAggregatedMojoFailureException-maven-plugin:1:test"
+ } ) );
+
+ maven.execute( request );
+
+ reporterCtl.verify();
+ }
+
+ private void buildTestAccessory( File basedir )
+ {
+ MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( basedir )
+ .setShowErrors( true )
+ .setErrorReporter( new DummyCoreErrorReporter() )
+ .setGoals( Arrays.asList( new String[] {
+ "clean",
+ "install"
+ } ) );
+
+ MavenExecutionResult result = maven.execute( request );
+
+ if ( result.hasExceptions() )
+ {
+ StringWriter writer = new StringWriter();
+ PrintWriter pWriter = new PrintWriter( writer );
+
+ writer.write( "Failed to build project in: " );
+ writer.write( basedir.getPath() );
+ writer.write( "\nEncountered the following errors:" );
+
+ for ( Iterator it = result.getExceptions().iterator(); it.hasNext(); )
+ {
+ Throwable error = (Throwable) it.next();
+ writer.write( "\n\n" );
+ error.printStackTrace( pWriter );
+ }
+
+ fail( writer.toString() );
+ }
}
public void testReportAttemptToOverrideUneditableMojoParameter()
@@ -277,8 +410,19 @@ public class ErrorReporterPointcutTest
public void testReportNoGoalsSpecifiedException()
{
- // TODO Auto-generated method stub
+ reporter.reportNoGoalsSpecifiedException( null, null );
+ reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
+ reporterCtl.setVoidCallable();
+ reporterCtl.replay();
+
+ MavenExecutionRequest request = new DefaultMavenExecutionRequest().setShowErrors( true )
+ .setErrorReporter( reporter )
+ .setGoals( Collections.EMPTY_LIST );
+
+ maven.execute( request );
+
+ reporterCtl.verify();
}
public void testReportPluginErrorWhileValidatingTask()
@@ -300,9 +444,26 @@ public class ErrorReporterPointcutTest
}
public void testReportProjectCycle()
+ throws URISyntaxException, IOException
{
- // TODO Auto-generated method stub
+ File projectDir = prepareProjectDir();
+ reporter.reportProjectCycle( null );
+ reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
+ reporterCtl.setVoidCallable();
+
+ reporterCtl.replay();
+
+ MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
+ .setShowErrors( true )
+ .setErrorReporter( reporter )
+ .setGoals( Arrays.asList( new String[] {
+ "initialize"
+ } ) );
+
+ maven.execute( request );
+
+ reporterCtl.verify();
}
public void testReportProjectDependenciesNotFound()
@@ -377,82 +538,149 @@ public class ErrorReporterPointcutTest
}
- public void clearErrors()
+ // FIXME: How can I test this when it's masked by reportActivatorErrorWhileGettingRepositoriesFromProfiles?
+ public void testReportActivatorError()
+ throws URISyntaxException, IOException
{
- // TODO Auto-generated method stub
+ File projectDir = prepareProjectDir();
+ reporter.reportActivatorError( null, null, null, null, null, null );
+ reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
+ reporterCtl.setVoidCallable();
+
+ reporterCtl.replay();
+
+ MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
+ .setShowErrors( true )
+ .setErrorReporter( reporter )
+ .setGoals( Arrays.asList( new String[] {
+ "initialize"
+ } ) );
+
+ maven.execute( request );
+
+ reporterCtl.verify();
}
- public Throwable findReportedException( Throwable error )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String getFormattedMessage( Throwable error )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public Throwable getRealCause( Throwable error )
- {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void testReportActivatorErrorWhileApplyingProfiles()
- {
- // TODO Auto-generated method stub
-
- }
-
- public void testReportActivatorErrorWhileGettingRepositoriesFromProfiles()
- {
- // TODO Auto-generated method stub
-
- }
-
- public void testReportActivatorLookupErrorWhileApplyingProfiles()
- {
- // TODO Auto-generated method stub
-
- }
-
- public void testReportActivatorLookupErrorWhileGettingRepositoriesFromProfiles()
+ public void testReportActivatorLookupError()
{
// TODO Auto-generated method stub
}
public void testReportBadDependencyVersion()
+ throws URISyntaxException, IOException
{
- // TODO Auto-generated method stub
+ File projectDir = prepareProjectDir();
+ reporter.reportBadDependencyVersion( null, null, null );
+ reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
+ reporterCtl.setVoidCallable();
+
+ reporterCtl.replay();
+
+ MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
+ .setShowErrors( true )
+ .setErrorReporter( reporter )
+ .setGoals( Arrays.asList( new String[] {
+ "compile"
+ } ) );
+
+ maven.execute( request );
+
+ reporterCtl.verify();
}
public void testReportBadManagedDependencyVersion()
+ throws URISyntaxException, IOException
{
- // TODO Auto-generated method stub
+ File projectDir = prepareProjectDir();
+ reporter.reportBadManagedDependencyVersion( null, null, null );
+ reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
+ reporterCtl.setVoidCallable();
+
+ reporterCtl.replay();
+
+ MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
+ .setShowErrors( true )
+ .setErrorReporter( reporter )
+ .setGoals( Arrays.asList( new String[] {
+ "initialize"
+ } ) );
+
+ maven.execute( request );
+
+ reporterCtl.verify();
}
public void testReportBadNonDependencyProjectArtifactVersion()
+ throws URISyntaxException, IOException
{
- // TODO Auto-generated method stub
+ File projectDir = prepareProjectDir();
+ reporter.reportBadNonDependencyProjectArtifactVersion( null, null, null );
+ reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
+ reporterCtl.setVoidCallable();
+
+ reporterCtl.replay();
+
+ MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
+ .setShowErrors( true )
+ .setErrorReporter( reporter )
+ .setGoals( Arrays.asList( new String[] {
+ "initialize"
+ } ) );
+
+ maven.execute( request );
+
+ reporterCtl.verify();
}
public void testReportErrorCreatingArtifactRepository()
+ throws URISyntaxException, IOException
{
- // TODO Auto-generated method stub
+ File projectDir = prepareProjectDir();
+ reporter.reportErrorCreatingArtifactRepository( null, null, null, null );
+ reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
+ reporterCtl.setVoidCallable();
+
+ reporterCtl.replay();
+
+ MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
+ .setShowErrors( true )
+ .setErrorReporter( reporter )
+ .setGoals( Arrays.asList( new String[] {
+ "compile"
+ } ) );
+
+ maven.execute( request );
+
+ reporterCtl.verify();
}
public void testReportErrorCreatingDeploymentArtifactRepository()
+ throws URISyntaxException, IOException
{
- // TODO Auto-generated method stub
+ File projectDir = prepareProjectDir();
+ reporter.reportErrorCreatingDeploymentArtifactRepository( null, null, null, null );
+ reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
+ reporterCtl.setVoidCallable();
+
+ reporterCtl.replay();
+
+ MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
+ .setShowErrors( true )
+ .setErrorReporter( reporter )
+ .setGoals( Arrays.asList( new String[] {
+ "compile"
+ } ) );
+
+ maven.execute( request );
+
+ reporterCtl.verify();
}
public void testReportErrorInterpolatingModel_UsingModelInstance()
@@ -520,7 +748,9 @@ public class ErrorReporterPointcutTest
reporterCtl.replay();
- MavenExecutionRequest request = new DefaultMavenExecutionRequest().setPom( new File( projectDir, "pom.xml" ) )
+ MavenExecutionRequest request = new DefaultMavenExecutionRequest().setPom( new File(
+ projectDir,
+ "pom.xml" ) )
.setShowErrors( true )
.setErrorReporter( reporter )
.setGoals( Arrays.asList( new String[] {
@@ -551,15 +781,49 @@ public class ErrorReporterPointcutTest
}
public void testReportProjectCollision()
+ throws URISyntaxException, IOException
{
- // TODO Auto-generated method stub
+ File projectDir = prepareProjectDir();
+ reporter.reportProjectCollision( null, null );
+ reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
+ reporterCtl.setVoidCallable();
+
+ reporterCtl.replay();
+
+ MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
+ .setShowErrors( true )
+ .setErrorReporter( reporter )
+ .setGoals( Arrays.asList( new String[] {
+ "initialize"
+ } ) );
+
+ maven.execute( request );
+
+ reporterCtl.verify();
}
public void testReportProjectValidationFailure()
+ throws URISyntaxException, IOException
{
- // TODO Auto-generated method stub
+ File projectDir = prepareProjectDir();
+ reporter.reportProjectValidationFailure( null, null, null );
+ reporterCtl.setMatcher( MockControl.ALWAYS_MATCHER );
+ reporterCtl.setVoidCallable();
+
+ reporterCtl.replay();
+
+ MavenExecutionRequest request = new DefaultMavenExecutionRequest().setBaseDirectory( projectDir )
+ .setShowErrors( true )
+ .setErrorReporter( reporter )
+ .setGoals( Arrays.asList( new String[] {
+ "initialize"
+ } ) );
+
+ maven.execute( request );
+
+ reporterCtl.verify();
}
}
diff --git a/maven-project/src/main/aspect/org/apache/maven/project/aspect/PBEDerivativeReporterAspect.aj b/maven-project/src/main/aspect/org/apache/maven/project/aspect/PBEDerivativeReporterAspect.aj
index 92f5dd1226..73c2166925 100644
--- a/maven-project/src/main/aspect/org/apache/maven/project/aspect/PBEDerivativeReporterAspect.aj
+++ b/maven-project/src/main/aspect/org/apache/maven/project/aspect/PBEDerivativeReporterAspect.aj
@@ -12,6 +12,7 @@ import org.apache.maven.model.Repository;
import org.apache.maven.model.DeploymentRepository;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.MavenTools;
+import org.apache.maven.project.build.model.DefaultModelLineageBuilder;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.DefaultMavenProjectBuilder;
import org.apache.maven.project.InvalidProjectModelException;
@@ -19,6 +20,7 @@ import org.apache.maven.project.ProjectBuildingException;
import java.io.File;
import java.util.Set;
+import java.util.List;
public privileged aspect PBEDerivativeReporterAspect
extends AbstractProjectErrorReporterAspect
@@ -34,6 +36,10 @@ public privileged aspect PBEDerivativeReporterAspect
execution( private MavenProject DefaultMavenProjectBuilder.processProjectLogic( MavenProject, File, .. ) )
&& args( project, pomFile, .. );
+ private pointcut within_pbldr_processProjectLogic( MavenProject project, File pomFile ):
+ withincode( private MavenProject DefaultMavenProjectBuilder.processProjectLogic( MavenProject, File, .. ) )
+ && args( project, pomFile, .. );
+
private pointcut within_DefaultMavenProjectBuilder():
!withincode( * DefaultProfileAdvisor.*( .. ) )
&& notWithinAspect();
@@ -63,8 +69,6 @@ public privileged aspect PBEDerivativeReporterAspect
call( ArtifactRepository MavenTools+.buildArtifactRepository( Repository ) )
&& args( repo );
- private boolean processingPluginRepositories = false;
-
// =========================================================================
// Call Stack:
// =========================================================================
@@ -82,31 +86,31 @@ public privileged aspect PBEDerivativeReporterAspect
after( MavenProject project, File pomFile, Repository repo ) throwing( UnknownRepositoryLayoutException cause ):
mavenTools_buildArtifactRepository( repo )
&& cflow( pbldr_processProjectLogic( project, pomFile ) )
- && within_DefaultMavenProjectBuilder()
{
- getReporter().reportErrorCreatingArtifactRepository( project, pomFile, repo, cause, processingPluginRepositories );
+ getReporter().reportErrorCreatingArtifactRepository( project.getId(), pomFile, repo, cause );
}
- after():
- call( * Model+.getPluginRepositories() )
- && cflow( pbldr_processProjectLogic( MavenProject, File ) )
- && within_DefaultMavenProjectBuilder()
- {
- processingPluginRepositories = true;
- }
+ private pointcut mlbldr_updateRepositorySet( Model model, File pomFile ):
+ execution( List DefaultModelLineageBuilder.updateRepositorySet( Model, *, File, .. ) )
+ && args( model, *, pomFile, .. );
- after():
- call( * Model+.getRepositories() )
- && cflow( pbldr_processProjectLogic( MavenProject, File ) )
- && within_DefaultMavenProjectBuilder()
+ // =========================================================================
+ // Call Stack:
+ // =========================================================================
+ // ...
+ // --> DefaultModelLineageBuilder.buildModelLineage(..)
+ // --> DefaultModelLineageBuilder.resumeBuildingModelLineage(..)
+ // --> DefaultModelLineageBuilder.updateRepositorySet(..) (private)
+ // --> DefaultMavenTools.buildArtifactRepositories(..)
+ // --> DefaultMavenTools.buildArtifactRepository(..)
+ // <------ UnknownRepositoryLayoutException
+ // <------ ProjectBuildingException
+ // =========================================================================
+ after( Model model, File pomFile, Repository repo ) throwing( UnknownRepositoryLayoutException cause ):
+ mavenTools_buildArtifactRepository( repo )
+ && cflow( mlbldr_updateRepositorySet( model, pomFile ) )
{
- processingPluginRepositories = false;
- }
-
- after( MavenProject project, File pomFile ):
- pbldr_processProjectLogic( project, pomFile )
- {
- processingPluginRepositories = false;
+ getReporter().reportErrorCreatingArtifactRepository( model.getId(), pomFile, repo, cause );
}
// ModelInterpolationException
diff --git a/maven-project/src/main/aspect/org/apache/maven/project/aspect/ProfileErrorReporterAspect.aj b/maven-project/src/main/aspect/org/apache/maven/project/aspect/ProfileErrorReporterAspect.aj
index 251b9e2478..751cbe9b44 100644
--- a/maven-project/src/main/aspect/org/apache/maven/project/aspect/ProfileErrorReporterAspect.aj
+++ b/maven-project/src/main/aspect/org/apache/maven/project/aspect/ProfileErrorReporterAspect.aj
@@ -72,7 +72,7 @@ public privileged aspect ProfileErrorReporterAspect
throwing( ComponentLookupException cause ):
applyActivatedProfiles_ComponentLookupException( model, pomFile, profile )
{
- getReporter().reportActivatorLookupErrorWhileApplyingProfiles( model, pomFile, profile, cause );
+ getReporter().reportActivatorLookupError( model.getId(), pomFile, profile, cause );
}
protected pointcut profileActivatorCall( ProfileActivator activator ):
@@ -107,7 +107,7 @@ public privileged aspect ProfileErrorReporterAspect
throwing( ProfileActivationException cause ):
applyActivatedProfiles_ActivatorThrown( activator, model, pomFile, profile, context )
{
- getReporter().reportActivatorErrorWhileApplyingProfiles( activator, model, pomFile, profile, context, cause );
+ getReporter().reportActivatorError( activator, model.getId(), pomFile, profile, context, cause );
}
private pointcut pAdv_loadExternalProjectProfiles( Model model, File pomFile ):
@@ -189,7 +189,7 @@ public privileged aspect ProfileErrorReporterAspect
throwing( ComponentLookupException cause ):
getArtifactRepositoriesFromActiveProfiles_ComponentLookupException( projectId, pomFile, profile )
{
- getReporter().reportActivatorLookupErrorWhileGettingRepositoriesFromProfiles( projectId, pomFile, profile, cause );
+ getReporter().reportActivatorLookupError( projectId, pomFile, profile, cause );
}
private pointcut getArtifactRepositoriesFromActiveProfiles_ActivatorThrown( ProfileActivator activator,
@@ -220,7 +220,7 @@ public privileged aspect ProfileErrorReporterAspect
throwing( ProfileActivationException cause ):
getArtifactRepositoriesFromActiveProfiles_ActivatorThrown( activator, projectId, pomFile, profile, context )
{
- getReporter().reportActivatorErrorWhileGettingRepositoriesFromProfiles( activator, projectId, pomFile, profile, context, cause );
+ getReporter().reportActivatorError( activator, projectId, pomFile, profile, context, cause );
}
private pointcut getArtifactRepositoriesFromActiveProfiles_InvalidRepository( Repository repo,
diff --git a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
index 5315d09e9f..b952106b6f 100644
--- a/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
+++ b/maven-project/src/main/java/org/apache/maven/project/DefaultMavenProjectBuilder.java
@@ -915,8 +915,15 @@ public class DefaultMavenProjectBuilder
validateModel( model, pomFile );
- project.setRemoteArtifactRepositories(
- mavenTools.buildArtifactRepositories( model.getRepositories() ) );
+ try
+ {
+ project.setRemoteArtifactRepositories(
+ mavenTools.buildArtifactRepositories( model.getRepositories() ) );
+ }
+ catch( Exception e )
+ {
+ e.printStackTrace();
+ }
String projectId = safeVersionlessKey( model.getGroupId(), model.getArtifactId() );
diff --git a/maven-project/src/main/java/org/apache/maven/project/error/DefaultProjectErrorReporter.java b/maven-project/src/main/java/org/apache/maven/project/error/DefaultProjectErrorReporter.java
index 3a02d8bd4b..e79ca0e474 100644
--- a/maven-project/src/main/java/org/apache/maven/project/error/DefaultProjectErrorReporter.java
+++ b/maven-project/src/main/java/org/apache/maven/project/error/DefaultProjectErrorReporter.java
@@ -114,51 +114,12 @@ public class DefaultProjectErrorReporter
/**
* @see org.apache.maven.project.error.ProjectErrorReporter#reportActivatorErrorWhileApplyingProfiles(org.apache.maven.profiles.activation.ProfileActivator, org.apache.maven.model.Model, java.io.File, org.apache.maven.model.Profile, org.apache.maven.profiles.activation.ProfileActivationContext, org.apache.maven.profiles.activation.ProfileActivationException)
*/
- public void reportActivatorErrorWhileApplyingProfiles( ProfileActivator activator,
- Model model,
- File pomFile,
- Profile profile,
- ProfileActivationContext context,
- ProfileActivationException cause )
- {
- StringWriter writer = new StringWriter();
-
- writer.write( NEWLINE );
- writer.write( "Profile activator: " );
- writer.write( activator.getClass().getName() );
- writer.write( " experienced an error 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.getTipsForActivatorErrorWhileApplyingProfiles( activator,
- model,
- pomFile,
- profile,
- context,
- cause ), writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- /**
- * @see org.apache.maven.project.error.ProjectErrorReporter#reportActivatorErrorWhileGettingRepositoriesFromProfiles(org.apache.maven.profiles.activation.ProfileActivator, java.lang.String, java.io.File, org.apache.maven.model.Profile, org.apache.maven.profiles.activation.ProfileActivationContext, org.apache.maven.profiles.activation.ProfileActivationException)
- */
- public void reportActivatorErrorWhileGettingRepositoriesFromProfiles( ProfileActivator activator,
- String projectId,
- File pomFile,
- Profile profile,
- ProfileActivationContext context,
- ProfileActivationException cause )
+ public void reportActivatorError( ProfileActivator activator,
+ String projectId,
+ File pomFile,
+ Profile profile,
+ ProfileActivationContext context,
+ ProfileActivationException cause )
{
StringWriter writer = new StringWriter();
@@ -179,58 +140,23 @@ public class DefaultProjectErrorReporter
writer.write( cause.getMessage() );
addStandardInfo( projectId, pomFile, writer );
- addTips( ProjectErrorTips.getTipsForActivatorErrorWhileGettingRepositoriesFromProfiles( activator,
- projectId,
- pomFile,
- profile,
- context,
- cause ),
- writer );
+ addTips( ProjectErrorTips.getTipsForActivatorError( activator,
+ projectId,
+ pomFile,
+ profile,
+ context,
+ cause ), writer );
registerBuildError( cause, writer.toString(), cause.getCause() );
}
/**
- * @see org.apache.maven.project.error.ProjectErrorReporter#reportActivatorLookupErrorWhileApplyingProfiles(org.apache.maven.model.Model, java.io.File, org.apache.maven.model.Profile, org.codehaus.plexus.component.repository.exception.ComponentLookupException)
+ * @see org.apache.maven.project.error.ProjectErrorReporter#reportActivatorLookupError(java.lang.String, java.io.File, org.apache.maven.model.Profile, org.codehaus.plexus.component.repository.exception.ComponentLookupException)
*/
- public void reportActivatorLookupErrorWhileApplyingProfiles( Model model,
- File pomFile,
- Profile profile,
- 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.getTipsForActivatorLookupErrorWhileApplyingProfiles( model,
- pomFile,
- profile,
- cause ),
- writer );
-
- registerBuildError( cause, writer.toString(), cause.getCause() );
- }
-
- /**
- * @see org.apache.maven.project.error.ProjectErrorReporter#reportActivatorLookupErrorWhileGettingRepositoriesFromProfiles(java.lang.String, java.io.File, org.apache.maven.model.Profile, org.codehaus.plexus.component.repository.exception.ComponentLookupException)
- */
- public void reportActivatorLookupErrorWhileGettingRepositoriesFromProfiles( String projectId,
- File pomFile,
- Profile profile,
- ComponentLookupException cause )
+ public void reportActivatorLookupError( String projectId,
+ File pomFile,
+ Profile profile,
+ ComponentLookupException cause )
{
StringWriter writer = new StringWriter();
@@ -249,11 +175,10 @@ public class DefaultProjectErrorReporter
writer.write( cause.getMessage() );
addStandardInfo( projectId, pomFile, writer );
- addTips( ProjectErrorTips.getTipsForActivatorLookupErrorWhileGettingRepositoriesFromProfiles( projectId,
- pomFile,
- profile,
- cause ),
- writer );
+ addTips( ProjectErrorTips.getTipsForActivatorLookupError( projectId,
+ pomFile,
+ profile,
+ cause ), writer );
registerBuildError( cause, writer.toString(), cause.getCause() );
}
@@ -385,11 +310,10 @@ public class DefaultProjectErrorReporter
}
}
- public void reportErrorCreatingArtifactRepository( MavenProject project,
+ public void reportErrorCreatingArtifactRepository( String projectId,
File pomFile,
Repository repo,
- UnknownRepositoryLayoutException cause,
- boolean isPluginRepo )
+ UnknownRepositoryLayoutException cause )
{
StringWriter writer = new StringWriter();
@@ -405,8 +329,8 @@ public class DefaultProjectErrorReporter
writer.write( cause.getMessage() );
writer.write( NEWLINE );
- addStandardInfo( project.getId(), pomFile, writer );
- addTips( ProjectErrorTips.getTipsForInvalidRepositorySpec( repo, project.getId(), pomFile, cause ),
+ addStandardInfo( projectId, pomFile, writer );
+ addTips( ProjectErrorTips.getTipsForInvalidRepositorySpec( repo, projectId, pomFile, cause ),
writer );
registerBuildError( cause, writer.toString() );
diff --git a/maven-project/src/main/java/org/apache/maven/project/error/ProjectErrorReporter.java b/maven-project/src/main/java/org/apache/maven/project/error/ProjectErrorReporter.java
index ade8e8e2b8..95fb6f7f61 100644
--- a/maven-project/src/main/java/org/apache/maven/project/error/ProjectErrorReporter.java
+++ b/maven-project/src/main/java/org/apache/maven/project/error/ProjectErrorReporter.java
@@ -45,27 +45,6 @@ public interface ProjectErrorReporter
* DefaultProfileAdvisor.applyActivatedProfiles(..)
* DefaultProfileAdvisor.applyActivatedExternalProfiles(..)
* --> DefaultProfileAdvisor.applyActivatedProfiles(..) (private)
- * --> DefaultProfileManager.getActiveProfiles(..)
- * --> DefaultProfileManager.isActive(..) (private)
- * --> ProfileActivator.canDetermineActivation(..)
- * --> ProfileActivator.isActive(..)
- * <------ ProfileActivationException
- * <------ ProjectBuildingException
- *
- */
- void reportActivatorErrorWhileApplyingProfiles( ProfileActivator activator,
- Model model,
- File pomFile,
- Profile profile,
- ProfileActivationContext context,
- ProfileActivationException cause );
-
- /**
- * Call Stack:
- *
- *
- * DefaultProfileAdvisor.applyActivatedProfiles(..)
- * DefaultProfileAdvisor.applyActivatedExternalProfiles(..)
* --> DefaultProfileAdvisor.getArtifactRepositoriesFromActiveProfiles(..)
* --> DefaultProfileManager.getActiveProfiles(..)
* --> DefaultProfileManager.isActive(..) (private)
@@ -75,12 +54,12 @@ public interface ProjectErrorReporter
* <------ ProjectBuildingException
*
*/
- void reportActivatorErrorWhileGettingRepositoriesFromProfiles( ProfileActivator activator,
- String projectId,
- File pomFile,
- Profile profile,
- ProfileActivationContext context,
- ProfileActivationException cause );
+ void reportActivatorError( ProfileActivator activator,
+ String projectId,
+ File pomFile,
+ Profile profile,
+ ProfileActivationContext context,
+ ProfileActivationException cause );
/**
* Call Stack:
@@ -89,25 +68,6 @@ public interface ProjectErrorReporter
* DefaultProfileAdvisor.applyActivatedProfiles(..)
* DefaultProfileAdvisor.applyActivatedExternalProfiles(..)
* --> DefaultProfileAdvisor.applyActivatedProfiles(..) (private)
- * --> DefaultProfileManager.getActiveProfiles(..)
- * --> DefaultProfileManager.isActive(..) (private)
- * --> PlexusContainer.lookupList(..)
- * <-- ComponentLookupException
- * <-- ProfileActivationException
- * <------ ProjectBuildingException
- *
- */
- void reportActivatorLookupErrorWhileApplyingProfiles( Model model,
- File pomFile,
- Profile profile,
- ComponentLookupException cause );
-
- /**
- * Call Stack:
- *
- *
- * DefaultProfileAdvisor.applyActivatedProfiles(..)
- * DefaultProfileAdvisor.applyActivatedExternalProfiles(..)
* --> DefaultProfileAdvisor.getArtifactRepositoriesFromActiveProfiles(..)
* --> DefaultProfileManager.getActiveProfiles(..)
* --> DefaultProfileManager.isActive(..) (private)
@@ -117,10 +77,10 @@ public interface ProjectErrorReporter
* <------ ProjectBuildingException
*
*/
- void reportActivatorLookupErrorWhileGettingRepositoriesFromProfiles( String projectId,
- File pomFile,
- Profile profile,
- ComponentLookupException cause );
+ void reportActivatorLookupError( String projectId,
+ File pomFile,
+ Profile profile,
+ ComponentLookupException cause );
/**
* Call Stack:
@@ -211,11 +171,10 @@ public interface ProjectErrorReporter
* <---------- ProjectBuildingException
*
*/
- void reportErrorCreatingArtifactRepository( MavenProject project,
+ void reportErrorCreatingArtifactRepository( String projectId,
File pomFile,
Repository repo,
- UnknownRepositoryLayoutException cause,
- boolean isPluginRepo );
+ UnknownRepositoryLayoutException cause );
/**
* Call Stack:
diff --git a/maven-project/src/main/java/org/apache/maven/project/error/ProjectErrorTips.java b/maven-project/src/main/java/org/apache/maven/project/error/ProjectErrorTips.java
index 5bb22e4f38..4ea20237d6 100644
--- a/maven-project/src/main/java/org/apache/maven/project/error/ProjectErrorTips.java
+++ b/maven-project/src/main/java/org/apache/maven/project/error/ProjectErrorTips.java
@@ -33,12 +33,12 @@ public final class ProjectErrorTips
{
}
- public static List getTipsForActivatorErrorWhileApplyingProfiles( ProfileActivator activator,
- Model model,
- File pomFile,
- Profile profile,
- ProfileActivationContext context,
- ProfileActivationException cause )
+ public static List getTipsForActivatorError( ProfileActivator activator,
+ String projectId,
+ File pomFile,
+ Profile profile,
+ ProfileActivationContext context,
+ ProfileActivationException cause )
{
return listOf( new String[]{ "If this is a standard profile activator, see "
+ "http://maven.apache.org/pom.html#Activation for help configuring profile activation.",
@@ -47,37 +47,10 @@ public final class ProjectErrorTips
"XSD location for profiles.xml: http://maven.apache.org/xsd/profiles-1.0.0.xsd" } );
}
- public static List getTipsForActivatorErrorWhileGettingRepositoriesFromProfiles( ProfileActivator activator,
- String projectId,
- File pomFile,
- Profile profile,
- ProfileActivationContext context,
- ProfileActivationException cause )
- {
- return listOf( new String[]{ "If this is a standard profile activator, see "
- + "http://maven.apache.org/pom.html#Activation for help configuring profile activation.",
- "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 getTipsForActivatorLookupErrorWhileApplyingProfiles( Model model,
- 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 getTipsForActivatorLookupErrorWhileGettingRepositoriesFromProfiles( String projectId,
- File pomFile,
- Profile profile,
- ComponentLookupException cause )
+ 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.",
diff --git a/pom.xml b/pom.xml
index f2fcf6509a..140080bfab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -227,6 +227,12 @@ under the License.
1.2_Java1.3
test
+