mirror of https://github.com/apache/maven.git
o reduce the signature of executeMojo in the pluginManager and propagate
git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@751512 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9a2c66dde1
commit
2d01e12568
|
@ -54,7 +54,6 @@ import org.apache.maven.plugin.descriptor.PluginDescriptor;
|
||||||
import org.apache.maven.plugin.lifecycle.Execution;
|
import org.apache.maven.plugin.lifecycle.Execution;
|
||||||
import org.apache.maven.plugin.lifecycle.Phase;
|
import org.apache.maven.plugin.lifecycle.Phase;
|
||||||
import org.apache.maven.project.MavenProject;
|
import org.apache.maven.project.MavenProject;
|
||||||
import org.apache.maven.project.artifact.InvalidDependencyVersionException;
|
|
||||||
import org.apache.maven.reporting.MavenReport;
|
import org.apache.maven.reporting.MavenReport;
|
||||||
import org.apache.maven.settings.Settings;
|
import org.apache.maven.settings.Settings;
|
||||||
import org.codehaus.plexus.component.annotations.Component;
|
import org.codehaus.plexus.component.annotations.Component;
|
||||||
|
@ -577,18 +576,6 @@ public class DefaultLifecycleExecutor
|
||||||
{
|
{
|
||||||
throw new LifecycleExecutionException( "Internal error in the plugin manager executing goal '" + mojoDescriptor.getId() + "': " + e.getMessage(), e );
|
throw new LifecycleExecutionException( "Internal error in the plugin manager executing goal '" + mojoDescriptor.getId() + "': " + e.getMessage(), e );
|
||||||
}
|
}
|
||||||
catch ( ArtifactNotFoundException e )
|
|
||||||
{
|
|
||||||
throw new LifecycleExecutionException( e.getMessage(), e );
|
|
||||||
}
|
|
||||||
catch ( InvalidDependencyVersionException e )
|
|
||||||
{
|
|
||||||
throw new LifecycleExecutionException( e.getMessage(), e );
|
|
||||||
}
|
|
||||||
catch ( ArtifactResolutionException e )
|
|
||||||
{
|
|
||||||
throw new LifecycleExecutionException( e.getMessage(), e );
|
|
||||||
}
|
|
||||||
catch ( MojoFailureException e )
|
catch ( MojoFailureException e )
|
||||||
{
|
{
|
||||||
throw new BuildFailureException( e.getMessage(), e );
|
throw new BuildFailureException( e.getMessage(), e );
|
||||||
|
|
|
@ -414,7 +414,7 @@ public class DefaultPluginManager
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
|
|
||||||
public void executeMojo( MavenProject project, MojoExecution mojoExecution, MavenSession session )
|
public void executeMojo( MavenProject project, MojoExecution mojoExecution, MavenSession session )
|
||||||
throws ArtifactResolutionException, MojoFailureException, ArtifactNotFoundException, InvalidDependencyVersionException, PluginManagerException, PluginConfigurationException
|
throws MojoFailureException, PluginExecutionException, PluginConfigurationException
|
||||||
{
|
{
|
||||||
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
|
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
|
||||||
|
|
||||||
|
@ -454,14 +454,32 @@ public class DefaultPluginManager
|
||||||
projects = Collections.singleton( project );
|
projects = Collections.singleton( project );
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( Iterator i = projects.iterator(); i.hasNext(); )
|
//!!jvz What is this? We resolveTransitiveDependencies() and then a line later downDependencies()? That can't be right. We should also already
|
||||||
|
// know at this point that what we need to execute can't be found. This is the wrong time to find this out.
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
MavenProject p = (MavenProject) i.next();
|
for ( Iterator i = projects.iterator(); i.hasNext(); )
|
||||||
|
{
|
||||||
|
MavenProject p = (MavenProject) i.next();
|
||||||
|
|
||||||
resolveTransitiveDependencies( session, repositorySystem, mojoDescriptor.isDependencyResolutionRequired(), p, mojoDescriptor.isAggregator() );
|
resolveTransitiveDependencies( session, repositorySystem, mojoDescriptor.isDependencyResolutionRequired(), p, mojoDescriptor.isAggregator() );
|
||||||
|
}
|
||||||
|
|
||||||
|
downloadDependencies( project, session, repositorySystem );
|
||||||
|
}
|
||||||
|
catch ( ArtifactResolutionException e )
|
||||||
|
{
|
||||||
|
throw new PluginExecutionException( mojoExecution, project, e.getMessage() );
|
||||||
|
}
|
||||||
|
catch ( InvalidDependencyVersionException e )
|
||||||
|
{
|
||||||
|
throw new PluginExecutionException( mojoExecution, project, e.getMessage() );
|
||||||
|
}
|
||||||
|
catch ( ArtifactNotFoundException e )
|
||||||
|
{
|
||||||
|
throw new PluginExecutionException( mojoExecution, project, e.getMessage() );
|
||||||
}
|
}
|
||||||
|
|
||||||
downloadDependencies( project, session, repositorySystem );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String goalName = mojoDescriptor.getFullGoalName();
|
String goalName = mojoDescriptor.getFullGoalName();
|
||||||
|
@ -486,11 +504,11 @@ public class DefaultPluginManager
|
||||||
}
|
}
|
||||||
catch ( XmlPullParserException e )
|
catch ( XmlPullParserException e )
|
||||||
{
|
{
|
||||||
throw new PluginManagerException( mojoDescriptor, project, "Failed to calculate concrete state for configuration of: " + mojoDescriptor.getHumanReadableKey(), e );
|
throw new PluginExecutionException( mojoExecution, project, "Failed to calculate concrete state for configuration of: " + mojoDescriptor.getHumanReadableKey() );
|
||||||
}
|
}
|
||||||
catch ( IOException e )
|
catch ( IOException e )
|
||||||
{
|
{
|
||||||
throw new PluginManagerException( mojoDescriptor, project, "Failed to calculate concrete state for configuration of: " + mojoDescriptor.getHumanReadableKey(), e );
|
throw new PluginExecutionException( mojoExecution, project, "Failed to calculate concrete state for configuration of: " + mojoDescriptor.getHumanReadableKey() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -594,6 +612,12 @@ public class DefaultPluginManager
|
||||||
|
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
catch ( PluginManagerException e )
|
||||||
|
{
|
||||||
|
session.getEventDispatcher().dispatchError( event, goalExecId, e );
|
||||||
|
|
||||||
|
throw new PluginExecutionException( mojoExecution, project, e.getMessage() );
|
||||||
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
if ( mojo != null )
|
if ( mojo != null )
|
||||||
|
|
|
@ -31,8 +31,8 @@ import org.apache.maven.reporting.MavenReport;
|
||||||
public interface PluginManager
|
public interface PluginManager
|
||||||
{
|
{
|
||||||
// - find the plugin [extension point: any client may wish to do whatever they choose]
|
// - find the plugin [extension point: any client may wish to do whatever they choose]
|
||||||
// - load the plugin [extension point: we want to take them from a repository, some may take from disk or whatever]
|
// - load the plugin into a classloader [extension point: we want to take them from a repository, some may take from disk or whatever]
|
||||||
// - configure the plugin
|
// - configure the plugin [extension point]
|
||||||
// - execute the plugin
|
// - execute the plugin
|
||||||
|
|
||||||
Plugin findPluginForPrefix( String prefix, MavenProject project, MavenSession session );
|
Plugin findPluginForPrefix( String prefix, MavenProject project, MavenSession session );
|
||||||
|
@ -40,10 +40,8 @@ public interface PluginManager
|
||||||
PluginDescriptor loadPlugin( Plugin plugin, MavenProject project, MavenSession session )
|
PluginDescriptor loadPlugin( Plugin plugin, MavenProject project, MavenSession session )
|
||||||
throws PluginLoaderException;
|
throws PluginLoaderException;
|
||||||
|
|
||||||
//!!jvz
|
|
||||||
// Clean up the exceptions returned. We should not be coupled to the repository layer. We need to generalize to allow a general plugin mechanism.
|
|
||||||
void executeMojo( MavenProject project, MojoExecution execution, MavenSession session )
|
void executeMojo( MavenProject project, MojoExecution execution, MavenSession session )
|
||||||
throws ArtifactResolutionException, MojoFailureException, ArtifactNotFoundException, InvalidDependencyVersionException, PluginManagerException, PluginConfigurationException;
|
throws MojoFailureException, PluginExecutionException, PluginConfigurationException;
|
||||||
|
|
||||||
//!!jvz
|
//!!jvz
|
||||||
// Reporting
|
// Reporting
|
||||||
|
|
Loading…
Reference in New Issue