mirror of https://github.com/apache/maven.git
o cleaning up the lifecycle executor and error reporter
git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@753053 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c5565158a1
commit
24139e8256
|
@ -20,10 +20,6 @@
|
||||||
<artifactId>maven-core</artifactId>
|
<artifactId>maven-core</artifactId>
|
||||||
<name>Maven Core</name>
|
<name>Maven Core</name>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.maven</groupId>
|
|
||||||
<artifactId>maven-lifecycle</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.maven</groupId>
|
<groupId>org.apache.maven</groupId>
|
||||||
<artifactId>maven-reporting-api</artifactId>
|
<artifactId>maven-reporting-api</artifactId>
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package org.apache.maven;
|
package org.apache.maven;
|
||||||
|
|
||||||
import org.apache.maven.lifecycle.MojoBindingUtils;
|
|
||||||
import org.apache.maven.lifecycle.model.MojoBinding;
|
|
||||||
import org.apache.maven.plugin.MojoFailureException;
|
import org.apache.maven.plugin.MojoFailureException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,18 +16,13 @@ public class AggregatedBuildFailureException
|
||||||
{
|
{
|
||||||
|
|
||||||
private final String executionRootDirectory;
|
private final String executionRootDirectory;
|
||||||
private final MojoBinding binding;
|
|
||||||
|
|
||||||
public AggregatedBuildFailureException( String executionRootDirectory,
|
public AggregatedBuildFailureException( String executionRootDirectory,
|
||||||
MojoBinding binding,
|
|
||||||
MojoFailureException cause )
|
MojoFailureException cause )
|
||||||
{
|
{
|
||||||
super( "Build in root directory: " + executionRootDirectory
|
super( "Build in root directory: " + executionRootDirectory + " failed during execution of aggregator mojo.", cause );
|
||||||
+ " failed during execution of aggregator mojo: "
|
|
||||||
+ MojoBindingUtils.toString( binding ), cause );
|
|
||||||
|
|
||||||
this.executionRootDirectory = executionRootDirectory;
|
this.executionRootDirectory = executionRootDirectory;
|
||||||
this.binding = binding;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MojoFailureException getMojoFailureException()
|
public MojoFailureException getMojoFailureException()
|
||||||
|
@ -41,10 +34,4 @@ public class AggregatedBuildFailureException
|
||||||
{
|
{
|
||||||
return executionRootDirectory;
|
return executionRootDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MojoBinding getBinding()
|
|
||||||
{
|
|
||||||
return binding;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class DefaultMaven
|
||||||
@Requirement
|
@Requirement
|
||||||
private Logger logger;
|
private Logger logger;
|
||||||
|
|
||||||
public List<Lifecycle> getLifecyclePhases()
|
public List<String> getLifecyclePhases()
|
||||||
{
|
{
|
||||||
return lifecycleExecutor.getLifecyclePhases();
|
return lifecycleExecutor.getLifecyclePhases();
|
||||||
}
|
}
|
||||||
|
@ -463,4 +463,24 @@ public class DefaultMaven
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Lifecycle phases
|
||||||
|
|
||||||
|
public List<Lifecycle> getBuildLifecyclePhases()
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Lifecycle> getCleanLifecyclePhases()
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Lifecycle> getSiteLifecyclePhases()
|
||||||
|
{
|
||||||
|
// TODO Auto-generated method stub
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,6 @@ import java.util.List;
|
||||||
import org.apache.maven.execution.MavenExecutionRequest;
|
import org.apache.maven.execution.MavenExecutionRequest;
|
||||||
import org.apache.maven.execution.MavenExecutionResult;
|
import org.apache.maven.execution.MavenExecutionResult;
|
||||||
import org.apache.maven.execution.ReactorManager;
|
import org.apache.maven.execution.ReactorManager;
|
||||||
import org.apache.maven.lifecycle.Lifecycle;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Jason van Zyl
|
* @author Jason van Zyl
|
||||||
|
@ -34,15 +33,16 @@ public interface Maven
|
||||||
{
|
{
|
||||||
static String ROLE = Maven.class.getName();
|
static String ROLE = Maven.class.getName();
|
||||||
|
|
||||||
//!! CLI pollution
|
//jvz!! CLI pollution
|
||||||
String POMv4 = "pom.xml";
|
String POMv4 = "pom.xml";
|
||||||
|
|
||||||
//!! release plugin pollution
|
//!!jvz release plugin pollution
|
||||||
String RELEASE_POMv4 = "release-pom.xml";
|
String RELEASE_POMv4 = "release-pom.xml";
|
||||||
|
|
||||||
MavenExecutionResult execute( MavenExecutionRequest request );
|
MavenExecutionResult execute( MavenExecutionRequest request );
|
||||||
|
|
||||||
|
//!!jvz This should not be exposed but is as a result of the buildProjectWithDependencies
|
||||||
ReactorManager createReactorManager( MavenExecutionRequest request, MavenExecutionResult result );
|
ReactorManager createReactorManager( MavenExecutionRequest request, MavenExecutionResult result );
|
||||||
|
|
||||||
List<Lifecycle> getLifecyclePhases();
|
List getLifecyclePhases();
|
||||||
}
|
}
|
|
@ -1,7 +1,5 @@
|
||||||
package org.apache.maven;
|
package org.apache.maven;
|
||||||
|
|
||||||
import org.apache.maven.lifecycle.MojoBindingUtils;
|
|
||||||
import org.apache.maven.lifecycle.model.MojoBinding;
|
|
||||||
import org.apache.maven.plugin.MojoFailureException;
|
import org.apache.maven.plugin.MojoFailureException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,17 +17,12 @@ public class ProjectBuildFailureException
|
||||||
{
|
{
|
||||||
|
|
||||||
private final String projectId;
|
private final String projectId;
|
||||||
private final MojoBinding binding;
|
|
||||||
|
|
||||||
public ProjectBuildFailureException( String projectId,
|
public ProjectBuildFailureException( String projectId, MojoFailureException cause )
|
||||||
MojoBinding binding,
|
|
||||||
MojoFailureException cause )
|
|
||||||
{
|
{
|
||||||
super( "Build for project: " + projectId + " failed during execution of mojo: "
|
super( "Build for project: " + projectId + " failed during execution of mojo.", cause );
|
||||||
+ MojoBindingUtils.toString( binding ), cause );
|
|
||||||
|
|
||||||
this.projectId = projectId;
|
this.projectId = projectId;
|
||||||
this.binding = binding;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MojoFailureException getMojoFailureException()
|
public MojoFailureException getMojoFailureException()
|
||||||
|
@ -41,10 +34,4 @@ public class ProjectBuildFailureException
|
||||||
{
|
{
|
||||||
return projectId;
|
return projectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MojoBinding getBinding()
|
|
||||||
{
|
|
||||||
return binding;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 );
|
|
||||||
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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 <distributionManagement/> 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 <dependencyManagement/> 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() );
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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 );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <b>Call Stack:</b>
|
|
||||||
* <br/>
|
|
||||||
* <pre>
|
|
||||||
* DefaultProfileAdvisor.applyActivatedProfiles(..)
|
|
||||||
* DefaultProfileAdvisor.applyActivatedExternalProfiles(..)
|
|
||||||
* --> DefaultProfileAdvisor.applyActivatedProfiles(..) (private)
|
|
||||||
* --> DefaultProfileAdvisor.getArtifactRepositoriesFromActiveProfiles(..)
|
|
||||||
* --> DefaultProfileManager.getActiveProfiles(..)
|
|
||||||
* --> DefaultProfileManager.isActive(..) (private)
|
|
||||||
* --> PlexusContainer.lookupList(..)
|
|
||||||
* <-- ComponentLookupException
|
|
||||||
* <-- ProfileActivationException
|
|
||||||
* <------ ProjectBuildingException
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
void reportActivatorLookupError( Model model,
|
|
||||||
File pomFile,
|
|
||||||
Profile profile,
|
|
||||||
ProfileActivationContext context,
|
|
||||||
ComponentLookupException cause );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <b>Call Stack:</b>
|
|
||||||
* <br/>
|
|
||||||
* <pre>
|
|
||||||
* DefaultProfileAdvisor.applyActivatedProfiles(..)
|
|
||||||
* DefaultProfileAdvisor.getArtifactRepositoriesFromActiveProfiles(..)
|
|
||||||
* --> DefaultProfileAdvisor.buildProfileManager(..) (private)
|
|
||||||
* --> DefaultProfileAdvisor.loadExternalProjectProfiles(..) (private)
|
|
||||||
* --> MavenProfilesBuilder.buildProfiles(..)
|
|
||||||
* <-- IOException
|
|
||||||
* <------ ProjectBuildingException
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
void reportErrorLoadingExternalProfilesFromFile( Model model,
|
|
||||||
File pomFile,
|
|
||||||
File projectDir,
|
|
||||||
IOException cause );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <b>Call Stack:</b>
|
|
||||||
* <br/>
|
|
||||||
* <pre>
|
|
||||||
* DefaultProfileAdvisor.applyActivatedProfiles(..)
|
|
||||||
* DefaultProfileAdvisor.getArtifactRepositoriesFromActiveProfiles(..)
|
|
||||||
* --> DefaultProfileAdvisor.buildProfileManager(..) (private)
|
|
||||||
* --> DefaultProfileAdvisor.loadExternalProjectProfiles(..) (private)
|
|
||||||
* --> MavenProfilesBuilder.buildProfiles(..)
|
|
||||||
* <-- XmlPullParserException
|
|
||||||
* <------ ProjectBuildingException
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
void reportErrorLoadingExternalProfilesFromFile( Model model,
|
|
||||||
File pomFile,
|
|
||||||
File projectDir,
|
|
||||||
XmlPullParserException cause );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <b>Call Stack:</b>
|
|
||||||
* <br/>
|
|
||||||
* <pre>
|
|
||||||
* DefaultProfileAdvisor.applyActivatedProfiles(..)
|
|
||||||
* DefaultProfileAdvisor.applyActivatedExternalProfiles(..)
|
|
||||||
* --> DefaultProfileAdvisor.getArtifactRepositoriesFromActiveProfiles(..)
|
|
||||||
* --> MavenTools.buildArtifactRepository(..)
|
|
||||||
* <-- InvalidRepositoryException
|
|
||||||
* <-- ProjectBuildingException
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
void reportInvalidRepositoryWhileGettingRepositoriesFromProfiles( Repository repo,
|
|
||||||
Model model,
|
|
||||||
File pomFile,
|
|
||||||
InvalidRepositoryException cause );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <b>Call Stack:</b>
|
|
||||||
* <br/>
|
|
||||||
* <pre>
|
|
||||||
* ...
|
|
||||||
* --> DefaultMavenProjectBuilder.buildFromRepository(..)
|
|
||||||
* DefaultMavenProjectBuilder.build(..)
|
|
||||||
* --> DefaultMavenProjectBuilder.buildFromSourceFileInternal(..) (private)
|
|
||||||
* --> DefaultMavenProjectBuilder.buildInternal(..) (private)
|
|
||||||
* --> DefaultMavenProjectBuilder.processProjectLogic(..) (private)
|
|
||||||
* --> DefaultMavenTools.buildDeploymentArtifactRepository(..)
|
|
||||||
* <-- UnknownRepositoryLayoutException
|
|
||||||
* <-------- ProjectBuildingException
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
void reportErrorCreatingDeploymentArtifactRepository( MavenProject project,
|
|
||||||
File pomFile,
|
|
||||||
DeploymentRepository repo,
|
|
||||||
InvalidRepositoryException cause );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <b>Call Stack:</b>
|
|
||||||
* <br/>
|
|
||||||
* <pre>
|
|
||||||
* ...
|
|
||||||
* --> DefaultMavenProjectBuilder.buildFromRepository(..)
|
|
||||||
* DefaultMavenProjectBuilder.build(..)
|
|
||||||
* --> DefaultMavenProjectBuilder.buildFromSourceFileInternal(..) (private)
|
|
||||||
* --> DefaultMavenProjectBuilder.buildInternal(..) (private)
|
|
||||||
* --> DefaultMavenProjectBuilder.processProjectLogic(..) (private)
|
|
||||||
* --> DefaultMavenTools.buildArtifactRepositories(..)
|
|
||||||
* --> DefaultMavenTools.buildArtifactRepository(..)
|
|
||||||
* <------ UnknownRepositoryLayoutException
|
|
||||||
* <---------- ProjectBuildingException
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
void reportErrorCreatingArtifactRepository( String projectId,
|
|
||||||
File pomFile,
|
|
||||||
Repository repo,
|
|
||||||
InvalidRepositoryException cause );
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <b>Call Stack:</b>
|
|
||||||
* <br/>
|
|
||||||
* <pre>
|
|
||||||
* ...
|
|
||||||
* --> DefaultMavenProjectBuilder.buildFromRepository(..)
|
|
||||||
* DefaultMavenProjectBuilder.build(..)
|
|
||||||
* --> DefaultMavenProjectBuilder.buildFromSourceFileInternal(..) (private)
|
|
||||||
* --> DefaultMavenProjectBuilder.buildInternal(..) (private)
|
|
||||||
* --> DefaultMavenProjectBuilder.processProjectLogic(..) (private)
|
|
||||||
* --> (model validator result)
|
|
||||||
* <-- InvalidProjectModelException
|
|
||||||
* <---------- ProjectBuildingException
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
void reportProjectValidationFailure( MavenProject project,
|
|
||||||
File pomFile,
|
|
||||||
InvalidProjectModelException error );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <b>Call Stack:</b>
|
|
||||||
* <br/>
|
|
||||||
* <pre>
|
|
||||||
* ...
|
|
||||||
* --> MavenProject.createArtifacts(..)
|
|
||||||
* --> MavenMetadataSource.createArtifacts(..)
|
|
||||||
* <-- InvalidDependencyVersionException
|
|
||||||
* <-- ProjectBuildingException
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
void reportBadDependencyVersion( MavenProject project,
|
|
||||||
File pomFile,
|
|
||||||
InvalidDependencyVersionException cause );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <b>Call Stack:</b>
|
|
||||||
* <br/>
|
|
||||||
* <pre>
|
|
||||||
* ...
|
|
||||||
* --> DefaultMavenProjectBuilder.buildFromRepository(..)
|
|
||||||
* --> DefaultMavenProjectBuilder.findModelFromRepository(..) (private)
|
|
||||||
* DefaultMavenProjectBuilder.build(..)
|
|
||||||
* --> DefaultMavenProjectBuilder.buildFromSourceFileInternal(..) (private)
|
|
||||||
* --> DefaultMavenProjectBuilder.readModel(..) (private)
|
|
||||||
* --> thrown XmlPullParserException
|
|
||||||
* <------ InvalidProjectModelException
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
void reportErrorParsingProjectModel( String projectId,
|
|
||||||
File pomFile,
|
|
||||||
XmlPullParserException cause );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <b>Call Stack:</b>
|
|
||||||
* <br/>
|
|
||||||
* <pre>
|
|
||||||
* ...
|
|
||||||
* --> DefaultMavenProjectBuilder.buildFromRepository(..)
|
|
||||||
* --> DefaultMavenProjectBuilder.findModelFromRepository(..) (private)
|
|
||||||
* DefaultMavenProjectBuilder.build(..)
|
|
||||||
* --> DefaultMavenProjectBuilder.buildFromSourceFileInternal(..) (private)
|
|
||||||
* --> DefaultMavenProjectBuilder.readModel(..) (private)
|
|
||||||
* --> thrown IOException
|
|
||||||
* <------ InvalidProjectModelException
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
void reportErrorParsingProjectModel( String projectId,
|
|
||||||
File pomFile,
|
|
||||||
IOException cause );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* <b>Call Stack:</b>
|
|
||||||
* <br/>
|
|
||||||
* <pre>
|
|
||||||
* MavenEmbedder.execute(MavenExecutionRequest)
|
|
||||||
* MavenEmbedder.readProjectWithDependencies(MavenExecutionRequest)
|
|
||||||
* --> DefaultMaven.execute(MavenExecutionRequest)
|
|
||||||
* --> DefaultMaven.createReactorManager(MavenExecutionRequest, MavenExecutionResult)
|
|
||||||
* --> new ReactorManager(List, String)
|
|
||||||
* --> new ProjectSorter(List)
|
|
||||||
* <----------------------- DuplicateProjectException
|
|
||||||
* </pre>
|
|
||||||
*/
|
|
||||||
void reportProjectCollision( List allProjectInstances,
|
|
||||||
DuplicateProjectException err );
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -22,7 +22,6 @@ import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.errors.CoreErrorReporter;
|
|
||||||
import org.apache.maven.monitor.event.EventMonitor;
|
import org.apache.maven.monitor.event.EventMonitor;
|
||||||
import org.apache.maven.profiles.ProfileActivationContext;
|
import org.apache.maven.profiles.ProfileActivationContext;
|
||||||
import org.apache.maven.profiles.ProfileManager;
|
import org.apache.maven.profiles.ProfileManager;
|
||||||
|
@ -609,8 +608,6 @@ public class DefaultMavenExecutionRequest
|
||||||
|
|
||||||
private Settings settings;
|
private Settings settings;
|
||||||
|
|
||||||
private CoreErrorReporter errorReporter;
|
|
||||||
|
|
||||||
private ProfileActivationContext profileActivationContext;
|
private ProfileActivationContext profileActivationContext;
|
||||||
|
|
||||||
// calculated from request attributes.
|
// calculated from request attributes.
|
||||||
|
@ -713,17 +710,6 @@ public class DefaultMavenExecutionRequest
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreErrorReporter getErrorReporter()
|
|
||||||
{
|
|
||||||
return errorReporter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public MavenExecutionRequest setErrorReporter( CoreErrorReporter reporter )
|
|
||||||
{
|
|
||||||
errorReporter = reporter;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProfileActivationContext getProfileActivationContext()
|
public ProfileActivationContext getProfileActivationContext()
|
||||||
{
|
{
|
||||||
return profileActivationContext;
|
return profileActivationContext;
|
||||||
|
|
|
@ -26,7 +26,6 @@ import java.util.Properties;
|
||||||
|
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
|
import org.apache.maven.artifact.repository.ArtifactRepositoryPolicy;
|
||||||
import org.apache.maven.errors.CoreErrorReporter;
|
|
||||||
import org.apache.maven.monitor.event.EventMonitor;
|
import org.apache.maven.monitor.event.EventMonitor;
|
||||||
import org.apache.maven.profiles.ProfileActivationContext;
|
import org.apache.maven.profiles.ProfileActivationContext;
|
||||||
import org.apache.maven.profiles.ProfileManager;
|
import org.apache.maven.profiles.ProfileManager;
|
||||||
|
@ -227,8 +226,5 @@ public interface MavenExecutionRequest
|
||||||
|
|
||||||
MavenExecutionRequest clearAccumulatedBuildState();
|
MavenExecutionRequest clearAccumulatedBuildState();
|
||||||
|
|
||||||
MavenExecutionRequest setErrorReporter( CoreErrorReporter reporter );
|
|
||||||
CoreErrorReporter getErrorReporter();
|
|
||||||
|
|
||||||
ProjectBuilderConfiguration getProjectBuildingConfiguration();
|
ProjectBuilderConfiguration getProjectBuildingConfiguration();
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,6 @@ import org.apache.maven.artifact.resolver.ArtifactResolutionException;
|
||||||
import org.apache.maven.execution.MavenSession;
|
import org.apache.maven.execution.MavenSession;
|
||||||
import org.apache.maven.execution.ReactorManager;
|
import org.apache.maven.execution.ReactorManager;
|
||||||
import org.apache.maven.lifecycle.mapping.LifecycleMapping;
|
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.Plugin;
|
||||||
import org.apache.maven.model.PluginExecution;
|
import org.apache.maven.model.PluginExecution;
|
||||||
import org.apache.maven.model.ReportPlugin;
|
import org.apache.maven.model.ReportPlugin;
|
||||||
|
@ -69,7 +67,6 @@ import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
||||||
* @author Jason van Zyl
|
* @author Jason van Zyl
|
||||||
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
|
* @author <a href="mailto:brett@apache.org">Brett Porter</a>
|
||||||
*/
|
*/
|
||||||
@Component(role = LifecycleExecutor.class)
|
|
||||||
public class DefaultLifecycleExecutor
|
public class DefaultLifecycleExecutor
|
||||||
extends AbstractLogEnabled
|
extends AbstractLogEnabled
|
||||||
implements LifecycleExecutor
|
implements LifecycleExecutor
|
||||||
|
@ -86,25 +83,22 @@ public class DefaultLifecycleExecutor
|
||||||
|
|
||||||
private Map phaseToLifecycleMap;
|
private Map phaseToLifecycleMap;
|
||||||
|
|
||||||
public List<Lifecycle> getLifecyclePhases()
|
public List<String> getLifecyclePhases()
|
||||||
{
|
{
|
||||||
return lifecycles;
|
for ( Lifecycle lifecycle : lifecycles )
|
||||||
|
{
|
||||||
|
if ( lifecycle.getId().equals( "default" ) )
|
||||||
|
{
|
||||||
|
return lifecycle.getPhases();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isValidPhaseName( final String phaseName )
|
public static boolean isValidPhaseName( final String phaseName )
|
||||||
{
|
{
|
||||||
LifecycleBindings test = new LifecycleBindings();
|
return true;
|
||||||
for ( Iterator it = test.getBindingList().iterator(); it.hasNext(); )
|
|
||||||
{
|
|
||||||
LifecycleBinding binding = (LifecycleBinding) it.next();
|
|
||||||
|
|
||||||
if ( binding.getPhaseNamesInOrder().contains( phaseName ) )
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -133,19 +127,13 @@ public class DefaultLifecycleExecutor
|
||||||
|
|
||||||
return new TaskValidationResult( task, "Cannot find mojo descriptor for: \'" + task + "\' - Treating as non-aggregator.", e );
|
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"
|
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";
|
+ " a goal in the format plugin:goal or pluginGroupId:pluginArtifactId:pluginVersion:goal";
|
||||||
|
|
||||||
return new TaskValidationResult( task, message, e );
|
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 )
|
catch ( InvalidPluginException e )
|
||||||
{
|
{
|
||||||
return new TaskValidationResult( task, e.getMessage(), e );
|
return new TaskValidationResult( task, e.getMessage(), e );
|
||||||
|
@ -164,7 +152,7 @@ public class DefaultLifecycleExecutor
|
||||||
* @throws PluginLoaderException
|
* @throws PluginLoaderException
|
||||||
*/
|
*/
|
||||||
private MojoDescriptor getMojoDescriptorForDirectInvocation( String task, MavenSession session, MavenProject project )
|
private MojoDescriptor getMojoDescriptorForDirectInvocation( String task, MavenSession session, MavenProject project )
|
||||||
throws InvalidPluginException, LifecycleSpecificationException, LifecycleLoaderException, PluginLoaderException
|
throws InvalidPluginException, PluginLoaderException, LifecycleExecutionException
|
||||||
{
|
{
|
||||||
MojoDescriptor descriptor;
|
MojoDescriptor descriptor;
|
||||||
|
|
||||||
|
@ -174,7 +162,7 @@ public class DefaultLifecycleExecutor
|
||||||
}
|
}
|
||||||
catch ( LifecycleExecutionException e )
|
catch ( LifecycleExecutionException e )
|
||||||
{
|
{
|
||||||
throw new LifecycleSpecificationException( "Cannot find the specified goal.", e );
|
throw new LifecycleExecutionException( "Cannot find the specified goal.", e );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( descriptor == null )
|
if ( descriptor == null )
|
||||||
|
|
|
@ -32,7 +32,7 @@ import org.apache.maven.project.MavenProject;
|
||||||
*/
|
*/
|
||||||
public interface LifecycleExecutor
|
public interface LifecycleExecutor
|
||||||
{
|
{
|
||||||
List<Lifecycle> getLifecyclePhases();
|
List<String> getLifecyclePhases();
|
||||||
|
|
||||||
TaskValidationResult isTaskValid( String task, MavenSession session, MavenProject rootProject );
|
TaskValidationResult isTaskValid( String task, MavenSession session, MavenProject rootProject );
|
||||||
|
|
||||||
|
|
|
@ -28,16 +28,7 @@ public class TaskValidationResult
|
||||||
|
|
||||||
public TaskValidationResult( String invalidTask,
|
public TaskValidationResult( String invalidTask,
|
||||||
String message,
|
String message,
|
||||||
LifecycleSpecificationException cause )
|
LifecycleExecutionException cause )
|
||||||
{
|
|
||||||
this.invalidTask = invalidTask;
|
|
||||||
this.message = message;
|
|
||||||
this.cause = cause;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TaskValidationResult( String invalidTask,
|
|
||||||
String message,
|
|
||||||
LifecycleLoaderException cause )
|
|
||||||
{
|
{
|
||||||
this.invalidTask = invalidTask;
|
this.invalidTask = invalidTask;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
|
|
|
@ -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 );
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -8,8 +8,6 @@ import org.apache.maven.artifact.repository.ArtifactRepository;
|
||||||
import org.apache.maven.execution.DefaultMavenExecutionRequest;
|
import org.apache.maven.execution.DefaultMavenExecutionRequest;
|
||||||
import org.apache.maven.execution.MavenExecutionRequest;
|
import org.apache.maven.execution.MavenExecutionRequest;
|
||||||
import org.apache.maven.execution.MavenSession;
|
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.model.Repository;
|
||||||
import org.apache.maven.plugin.MavenPluginCollector;
|
import org.apache.maven.plugin.MavenPluginCollector;
|
||||||
import org.apache.maven.plugin.MavenPluginDiscoverer;
|
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.component.annotations.Requirement;
|
||||||
import org.codehaus.plexus.logging.console.ConsoleLogger;
|
import org.codehaus.plexus.logging.console.ConsoleLogger;
|
||||||
import org.codehaus.plexus.util.FileUtils;
|
import org.codehaus.plexus.util.FileUtils;
|
||||||
import org.codehaus.plexus.util.xml.Xpp3Dom;
|
|
||||||
|
|
||||||
public class LifecycleExecutorTest
|
public class LifecycleExecutorTest
|
||||||
extends PlexusTestCase
|
extends PlexusTestCase
|
||||||
|
@ -56,6 +53,11 @@ public class LifecycleExecutorTest
|
||||||
lifecycleExecutor = (DefaultLifecycleExecutor) lookup( LifecycleExecutor.class );
|
lifecycleExecutor = (DefaultLifecycleExecutor) lookup( LifecycleExecutor.class );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testLifecyclePhases()
|
||||||
|
{
|
||||||
|
assertNotNull( lifecycleExecutor.getLifecyclePhases() );
|
||||||
|
}
|
||||||
|
|
||||||
public void testMojoExecution()
|
public void testMojoExecution()
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
|
@ -113,30 +115,6 @@ public class LifecycleExecutorTest
|
||||||
|
|
||||||
MojoExecution me = new MojoExecution( mojoDescriptor );
|
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
|
// 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.
|
// Now the magical mojo descriptor is complete and I can execute the mojo.
|
||||||
|
|
|
@ -12,8 +12,6 @@ import java.util.TimeZone;
|
||||||
import org.apache.maven.ProjectBuildFailureException;
|
import org.apache.maven.ProjectBuildFailureException;
|
||||||
import org.apache.maven.embedder.MavenEmbedderConsoleLogger;
|
import org.apache.maven.embedder.MavenEmbedderConsoleLogger;
|
||||||
import org.apache.maven.embedder.MavenEmbedderLogger;
|
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.ApplicationInformation;
|
||||||
import org.apache.maven.execution.DefaultRuntimeInformation;
|
import org.apache.maven.execution.DefaultRuntimeInformation;
|
||||||
import org.apache.maven.execution.MavenExecutionRequest;
|
import org.apache.maven.execution.MavenExecutionRequest;
|
||||||
|
@ -85,7 +83,7 @@ public final class CLIReportingUtils
|
||||||
{
|
{
|
||||||
Exception e = (Exception) i.next();
|
Exception e = (Exception) i.next();
|
||||||
|
|
||||||
showError( e, request.isShowErrors(), request.getErrorReporter(), logger );
|
showError( e, request.isShowErrors(), logger );
|
||||||
}
|
}
|
||||||
|
|
||||||
line( logger );
|
line( logger );
|
||||||
|
@ -133,7 +131,7 @@ public final class CLIReportingUtils
|
||||||
{
|
{
|
||||||
MavenEmbedderLogger logger = new MavenEmbedderConsoleLogger();
|
MavenEmbedderLogger logger = new MavenEmbedderConsoleLogger();
|
||||||
|
|
||||||
showError( message, e, showErrors, new DefaultCoreErrorReporter(), logger );
|
showError( message, e, showErrors, logger );
|
||||||
|
|
||||||
if ( !showErrors )
|
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
|
* @param logger
|
||||||
*/
|
*/
|
||||||
//mkleint: public because used in netbeans integration
|
//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();
|
StringWriter writer = new StringWriter();
|
||||||
|
|
||||||
|
@ -167,7 +165,7 @@ public final class CLIReportingUtils
|
||||||
writer.write( NEWLINE );
|
writer.write( NEWLINE );
|
||||||
}
|
}
|
||||||
|
|
||||||
buildErrorMessage( e, showStackTraces, reporter, writer );
|
buildErrorMessage( e, showStackTraces, writer );
|
||||||
|
|
||||||
writer.write( NEWLINE );
|
writer.write( NEWLINE );
|
||||||
|
|
||||||
|
@ -182,34 +180,8 @@ public final class CLIReportingUtils
|
||||||
logger.error( writer.toString() );
|
logger.error( writer.toString() );
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void buildErrorMessage( Exception e, boolean showStackTraces, CoreErrorReporter reporter, StringWriter writer )
|
public static void buildErrorMessage( Exception e, boolean showStackTraces, 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean handled = false;
|
boolean handled = false;
|
||||||
|
|
||||||
if ( e instanceof ProjectBuildingException )
|
if ( e instanceof ProjectBuildingException )
|
||||||
|
|
|
@ -19,6 +19,8 @@ package org.apache.maven.cli;
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
import org.apache.commons.cli.CommandLine;
|
import org.apache.commons.cli.CommandLine;
|
||||||
import org.apache.commons.cli.ParseException;
|
import org.apache.commons.cli.ParseException;
|
||||||
import org.apache.maven.embedder.Configuration;
|
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.MavenEmbedderException;
|
||||||
import org.apache.maven.embedder.MavenEmbedderFileLogger;
|
import org.apache.maven.embedder.MavenEmbedderFileLogger;
|
||||||
import org.apache.maven.embedder.MavenEmbedderLogger;
|
import org.apache.maven.embedder.MavenEmbedderLogger;
|
||||||
import org.apache.maven.errors.DefaultCoreErrorReporter;
|
|
||||||
import org.apache.maven.execution.MavenExecutionRequest;
|
import org.apache.maven.execution.MavenExecutionRequest;
|
||||||
import org.apache.maven.execution.MavenExecutionResult;
|
import org.apache.maven.execution.MavenExecutionResult;
|
||||||
import org.codehaus.plexus.classworlds.ClassWorld;
|
import org.codehaus.plexus.classworlds.ClassWorld;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author jason van zyl
|
* @author jason van zyl
|
||||||
* @noinspection UseOfSystemOutOrSystemErr,ACCESS_STATIC_VIA_INSTANCE
|
* @noinspection UseOfSystemOutOrSystemErr,ACCESS_STATIC_VIA_INSTANCE
|
||||||
|
@ -203,7 +202,6 @@ public class MavenCli
|
||||||
}
|
}
|
||||||
|
|
||||||
Configuration configuration = new DefaultConfiguration()
|
Configuration configuration = new DefaultConfiguration()
|
||||||
.setErrorReporter( new DefaultCoreErrorReporter() )
|
|
||||||
.setUserSettingsFile( userSettingsFile )
|
.setUserSettingsFile( userSettingsFile )
|
||||||
.setGlobalSettingsFile( globalSettingsFile )
|
.setGlobalSettingsFile( globalSettingsFile )
|
||||||
.setClassWorld( classWorld );
|
.setClassWorld( classWorld );
|
||||||
|
|
|
@ -18,17 +18,16 @@ package org.apache.maven.embedder;
|
||||||
* under the License.
|
* 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.io.File;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
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.
|
* Configuration of embedder, used when starting up.
|
||||||
*
|
*
|
||||||
|
@ -134,14 +133,6 @@ public interface Configuration
|
||||||
|
|
||||||
MavenRealmManager getRealmManager();
|
MavenRealmManager getRealmManager();
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
// Error Reporter
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Configuration setErrorReporter( CoreErrorReporter errorReporter );
|
|
||||||
|
|
||||||
CoreErrorReporter getErrorReporter();
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Event Monitors
|
// Event Monitors
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
|
@ -18,18 +18,17 @@ package org.apache.maven.embedder;
|
||||||
* under the License.
|
* 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.io.File;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
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.
|
* Default implementation of Configuration intefrace.
|
||||||
*
|
*
|
||||||
|
@ -62,8 +61,6 @@ public class DefaultConfiguration
|
||||||
|
|
||||||
private MavenRealmManager realmManager;
|
private MavenRealmManager realmManager;
|
||||||
|
|
||||||
private CoreErrorReporter errorReporter;
|
|
||||||
|
|
||||||
private List<EventMonitor> eventMonitors;
|
private List<EventMonitor> eventMonitors;
|
||||||
|
|
||||||
/** Creates a new instance of DefaultConfiguration */
|
/** Creates a new instance of DefaultConfiguration */
|
||||||
|
@ -238,17 +235,6 @@ public class DefaultConfiguration
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CoreErrorReporter getErrorReporter()
|
|
||||||
{
|
|
||||||
return errorReporter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Configuration setErrorReporter( CoreErrorReporter errorReporter )
|
|
||||||
{
|
|
||||||
this.errorReporter = errorReporter;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Configuration addEventMonitor( EventMonitor eventMonitor )
|
public Configuration addEventMonitor( EventMonitor eventMonitor )
|
||||||
{
|
{
|
||||||
if ( eventMonitors == null )
|
if ( eventMonitors == null )
|
||||||
|
|
|
@ -23,42 +23,28 @@ import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.net.URL;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.maven.Maven;
|
import org.apache.maven.Maven;
|
||||||
import org.apache.maven.artifact.repository.ArtifactRepository;
|
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.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.DefaultMavenExecutionRequest;
|
||||||
import org.apache.maven.execution.DefaultMavenExecutionResult;
|
import org.apache.maven.execution.DefaultMavenExecutionResult;
|
||||||
import org.apache.maven.execution.MavenExecutionRequest;
|
import org.apache.maven.execution.MavenExecutionRequest;
|
||||||
import org.apache.maven.execution.MavenExecutionResult;
|
import org.apache.maven.execution.MavenExecutionResult;
|
||||||
import org.apache.maven.execution.MavenSession;
|
import org.apache.maven.execution.MavenSession;
|
||||||
import org.apache.maven.execution.ReactorManager;
|
import org.apache.maven.execution.ReactorManager;
|
||||||
import org.apache.maven.lifecycle.LifecycleUtils;
|
|
||||||
import org.apache.maven.model.Model;
|
import org.apache.maven.model.Model;
|
||||||
import org.apache.maven.model.Plugin;
|
import org.apache.maven.model.Plugin;
|
||||||
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
import org.apache.maven.model.io.xpp3.MavenXpp3Reader;
|
||||||
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
|
import org.apache.maven.model.io.xpp3.MavenXpp3Writer;
|
||||||
import org.apache.maven.monitor.event.DefaultEventDispatcher;
|
import org.apache.maven.monitor.event.DefaultEventDispatcher;
|
||||||
import org.apache.maven.monitor.event.EventDispatcher;
|
import org.apache.maven.monitor.event.EventDispatcher;
|
||||||
import org.apache.maven.plugin.InvalidPluginException;
|
|
||||||
import org.apache.maven.plugin.MavenPluginCollector;
|
import org.apache.maven.plugin.MavenPluginCollector;
|
||||||
import org.apache.maven.plugin.MavenPluginDiscoverer;
|
import org.apache.maven.plugin.MavenPluginDiscoverer;
|
||||||
import org.apache.maven.plugin.MojoExecution;
|
|
||||||
import org.apache.maven.plugin.PluginLoaderException;
|
import org.apache.maven.plugin.PluginLoaderException;
|
||||||
import org.apache.maven.plugin.PluginManager;
|
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.MavenProject;
|
||||||
import org.apache.maven.project.MavenProjectBuilder;
|
import org.apache.maven.project.MavenProjectBuilder;
|
||||||
import org.apache.maven.project.MavenProjectBuildingResult;
|
import org.apache.maven.project.MavenProjectBuildingResult;
|
||||||
|
@ -81,11 +67,7 @@ import org.codehaus.plexus.PlexusContainer;
|
||||||
import org.codehaus.plexus.PlexusContainerException;
|
import org.codehaus.plexus.PlexusContainerException;
|
||||||
import org.codehaus.plexus.classworlds.ClassWorld;
|
import org.codehaus.plexus.classworlds.ClassWorld;
|
||||||
import org.codehaus.plexus.classworlds.realm.ClassRealm;
|
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.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.logging.LoggerManager;
|
||||||
import org.codehaus.plexus.util.IOUtil;
|
import org.codehaus.plexus.util.IOUtil;
|
||||||
import org.codehaus.plexus.util.ReaderFactory;
|
import org.codehaus.plexus.util.ReaderFactory;
|
||||||
|
@ -314,11 +296,6 @@ public class MavenEmbedder
|
||||||
public MavenProject readProject( File mavenProject )
|
public MavenProject readProject( File mavenProject )
|
||||||
throws ProjectBuildingException, MavenExecutionException
|
throws ProjectBuildingException, MavenExecutionException
|
||||||
{
|
{
|
||||||
CoreErrorReporter errorReporter = request.getErrorReporter();
|
|
||||||
errorReporter.clearErrors();
|
|
||||||
|
|
||||||
CoreReporterManager.setReporter( errorReporter );
|
|
||||||
|
|
||||||
return readProject( mavenProject, request );
|
return readProject( mavenProject, request );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -343,11 +320,6 @@ public class MavenEmbedder
|
||||||
{
|
{
|
||||||
request = populator.populateDefaults( request, configuration );
|
request = populator.populateDefaults( request, configuration );
|
||||||
|
|
||||||
CoreErrorReporter errorReporter = request.getErrorReporter();
|
|
||||||
errorReporter.clearErrors();
|
|
||||||
|
|
||||||
CoreReporterManager.setReporter( errorReporter );
|
|
||||||
|
|
||||||
readProject( request.getPom(), request );
|
readProject( request.getPom(), request );
|
||||||
}
|
}
|
||||||
catch ( MavenEmbedderException e )
|
catch ( MavenEmbedderException e )
|
||||||
|
@ -374,9 +346,7 @@ public class MavenEmbedder
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
projectBuildingResult = mavenProjectBuilder.buildProjectWithDependencies(
|
projectBuildingResult = mavenProjectBuilder.buildProjectWithDependencies( request.getPom(), request.getProjectBuildingConfiguration() );
|
||||||
request.getPom(),
|
|
||||||
request.getProjectBuildingConfiguration() );
|
|
||||||
}
|
}
|
||||||
catch ( ProjectBuildingException e )
|
catch ( ProjectBuildingException e )
|
||||||
{
|
{
|
||||||
|
@ -409,21 +379,6 @@ public class MavenEmbedder
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
// Lifecycle information
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
public List getLifecyclePhases()
|
|
||||||
{
|
|
||||||
return getBuildLifecyclePhases();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public List getBuildLifecyclePhases()
|
|
||||||
{
|
|
||||||
return LifecycleUtils.getValidBuildPhaseNames();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Lifecycle
|
// Lifecycle
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
@ -644,11 +599,6 @@ public class MavenEmbedder
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreErrorReporter errorReporter = request.getErrorReporter();
|
|
||||||
errorReporter.clearErrors();
|
|
||||||
|
|
||||||
CoreReporterManager.setReporter( errorReporter );
|
|
||||||
|
|
||||||
return maven.execute( request );
|
return maven.execute( request );
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
@ -666,4 +616,9 @@ public class MavenEmbedder
|
||||||
{
|
{
|
||||||
return container;
|
return container;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List getLifecyclePhases()
|
||||||
|
{
|
||||||
|
return maven.getLifecyclePhases();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@ package org.apache.maven.embedder.execution;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
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.Configuration;
|
||||||
import org.apache.maven.embedder.MavenEmbedder;
|
import org.apache.maven.embedder.MavenEmbedder;
|
||||||
import org.apache.maven.embedder.MavenEmbedderException;
|
import org.apache.maven.embedder.MavenEmbedderException;
|
||||||
import org.apache.maven.errors.DefaultCoreErrorReporter;
|
|
||||||
import org.apache.maven.execution.MavenExecutionRequest;
|
import org.apache.maven.execution.MavenExecutionRequest;
|
||||||
import org.apache.maven.model.Profile;
|
import org.apache.maven.model.Profile;
|
||||||
import org.apache.maven.model.Repository;
|
import org.apache.maven.model.Repository;
|
||||||
|
@ -87,8 +85,6 @@ public class DefaultMavenExecutionRequestPopulator
|
||||||
{
|
{
|
||||||
eventing( request, configuration );
|
eventing( request, configuration );
|
||||||
|
|
||||||
reporter( request, configuration );
|
|
||||||
|
|
||||||
executionProperties( request, configuration );
|
executionProperties( request, configuration );
|
||||||
|
|
||||||
pom( request, configuration );
|
pom( request, configuration );
|
||||||
|
@ -108,21 +104,6 @@ public class DefaultMavenExecutionRequestPopulator
|
||||||
return request;
|
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 )
|
private void executionProperties( MavenExecutionRequest request, Configuration configuration )
|
||||||
{
|
{
|
||||||
Properties requestProperties = request.getProperties();
|
Properties requestProperties = request.getProperties();
|
||||||
|
|
|
@ -19,6 +19,17 @@ package org.apache.maven.embedder;
|
||||||
* under the License.
|
* 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.artifact.Artifact;
|
||||||
import org.apache.maven.execution.DefaultMavenExecutionRequest;
|
import org.apache.maven.execution.DefaultMavenExecutionRequest;
|
||||||
import org.apache.maven.execution.MavenExecutionRequest;
|
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.SettingsConfigurationException;
|
||||||
import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader;
|
import org.apache.maven.settings.io.xpp3.SettingsXpp3Reader;
|
||||||
import org.apache.maven.settings.io.xpp3.SettingsXpp3Writer;
|
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.FileUtils;
|
||||||
import org.codehaus.plexus.util.IOUtil;
|
import org.codehaus.plexus.util.IOUtil;
|
||||||
import org.codehaus.plexus.util.ReaderFactory;
|
import org.codehaus.plexus.util.ReaderFactory;
|
||||||
import org.codehaus.plexus.util.WriterFactory;
|
import org.codehaus.plexus.util.WriterFactory;
|
||||||
import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
|
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
|
public class MavenEmbedderTest
|
||||||
extends TestCase
|
extends TestCase
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue