mirror of https://github.com/apache/maven.git
Fixed forking from reports.
git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@541950 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a55e9c24fe
commit
008d6943bc
|
@ -55,6 +55,7 @@ public class DefaultBuildPlanner
|
|||
|
||||
BuildPlan plan = new BuildPlan( packagingBindings, projectBindings, defaultBindings, tasks );
|
||||
|
||||
// initialize/resolve any direct-invocation tasks, if possible.
|
||||
initializeDirectInvocations( plan, project );
|
||||
|
||||
// Inject forked lifecycles as plan modifiers for each mojo that has @execute in it.
|
||||
|
@ -108,28 +109,7 @@ public class DefaultBuildPlanner
|
|||
private void findForkModifiers( final MojoBinding mojoBinding, final BuildPlan plan, final MavenProject project )
|
||||
throws LifecyclePlannerException, LifecycleSpecificationException, LifecycleLoaderException
|
||||
{
|
||||
PluginDescriptor pluginDescriptor = null;
|
||||
try
|
||||
{
|
||||
pluginDescriptor = pluginLoader.loadPlugin( mojoBinding, project );
|
||||
}
|
||||
catch ( PluginLoaderException e )
|
||||
{
|
||||
String message =
|
||||
"Failed to load plugin: " + MojoBindingUtils.createPluginKey( mojoBinding )
|
||||
+ ". Adding to late-bound plugins list.\nReason: " + e.getMessage();
|
||||
|
||||
if ( logger.isDebugEnabled() )
|
||||
{
|
||||
logger.debug( message, e );
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.warn( message );
|
||||
}
|
||||
|
||||
plan.addLateBoundMojo( mojoBinding );
|
||||
}
|
||||
PluginDescriptor pluginDescriptor = loadPluginDescriptor( mojoBinding, plan, project );
|
||||
|
||||
if ( pluginDescriptor == null )
|
||||
{
|
||||
|
@ -161,6 +141,51 @@ public class DefaultBuildPlanner
|
|||
{
|
||||
MojoBinding mojoBinding = (MojoBinding) it.next();
|
||||
|
||||
PluginDescriptor pluginDescriptor = loadPluginDescriptor( mojoBinding, plan, project );
|
||||
|
||||
if ( pluginDescriptor == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( mojoBinding.getGoal() );
|
||||
if ( mojoDescriptor == null )
|
||||
{
|
||||
throw new LifecyclePlannerException( "Mojo: " + mojoBinding.getGoal() + " does not exist in plugin: "
|
||||
+ pluginDescriptor.getId() + "." );
|
||||
}
|
||||
|
||||
if ( mojoDescriptor.isRequiresReports() )
|
||||
{
|
||||
List reportBindings = lifecycleBindingManager.getReportBindings( project );
|
||||
|
||||
if ( reportBindings != null )
|
||||
{
|
||||
plan.addForkedExecution( mojoBinding, reportBindings );
|
||||
|
||||
for ( Iterator reportBindingIt = reportBindings.iterator(); reportBindingIt.hasNext(); )
|
||||
{
|
||||
MojoBinding reportBinding = (MojoBinding) reportBindingIt.next();
|
||||
|
||||
PluginDescriptor pd = loadPluginDescriptor( reportBinding, plan, project );
|
||||
|
||||
if ( pd != null )
|
||||
{
|
||||
findForkModifiers( reportBinding, pluginDescriptor, plan, project );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NOTE: the first sighting of a mojo requiring reports should satisfy this condition.
|
||||
// therefore, we can break out as soon as we find one.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private PluginDescriptor loadPluginDescriptor( final MojoBinding mojoBinding, final BuildPlan plan,
|
||||
final MavenProject project )
|
||||
{
|
||||
PluginDescriptor pluginDescriptor = null;
|
||||
try
|
||||
{
|
||||
|
@ -184,45 +209,7 @@ public class DefaultBuildPlanner
|
|||
plan.addLateBoundMojo( mojoBinding );
|
||||
}
|
||||
|
||||
if ( pluginDescriptor == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( mojoBinding.getGoal() );
|
||||
if ( mojoDescriptor == null )
|
||||
{
|
||||
throw new LifecyclePlannerException( "Mojo: " + mojoBinding.getGoal() + " does not exist in plugin: "
|
||||
+ pluginDescriptor.getId() + "." );
|
||||
}
|
||||
|
||||
if ( mojoDescriptor.isRequiresReports() )
|
||||
{
|
||||
List reportBindings = lifecycleBindingManager.getReportBindings( project );
|
||||
|
||||
for ( Iterator reportBindingIt = reportBindings.iterator(); reportBindingIt.hasNext(); )
|
||||
{
|
||||
MojoBinding reportBinding = (MojoBinding) reportBindingIt.next();
|
||||
|
||||
try
|
||||
{
|
||||
pluginLoader.loadReportPlugin( mojoBinding, project );
|
||||
}
|
||||
catch ( PluginLoaderException e )
|
||||
{
|
||||
throw new LifecyclePlannerException( "Failed to load report-plugin descriptor for: "
|
||||
+ MojoBindingUtils.toString( reportBinding )
|
||||
+ ". Reason: " + e.getMessage(), e );
|
||||
}
|
||||
}
|
||||
|
||||
plan.addForkedExecution( mojoBinding, reportBindings );
|
||||
|
||||
// NOTE: the first sighting of a mojo requiring reports should satisfy this condition.
|
||||
// therefore, we can break out as soon as we find one.
|
||||
break;
|
||||
}
|
||||
}
|
||||
return pluginDescriptor;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue