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 );
|
BuildPlan plan = new BuildPlan( packagingBindings, projectBindings, defaultBindings, tasks );
|
||||||
|
|
||||||
|
// initialize/resolve any direct-invocation tasks, if possible.
|
||||||
initializeDirectInvocations( plan, project );
|
initializeDirectInvocations( plan, project );
|
||||||
|
|
||||||
// Inject forked lifecycles as plan modifiers for each mojo that has @execute in it.
|
// 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 )
|
private void findForkModifiers( final MojoBinding mojoBinding, final BuildPlan plan, final MavenProject project )
|
||||||
throws LifecyclePlannerException, LifecycleSpecificationException, LifecycleLoaderException
|
throws LifecyclePlannerException, LifecycleSpecificationException, LifecycleLoaderException
|
||||||
{
|
{
|
||||||
PluginDescriptor pluginDescriptor = null;
|
PluginDescriptor pluginDescriptor = loadPluginDescriptor( mojoBinding, plan, project );
|
||||||
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 );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( pluginDescriptor == null )
|
if ( pluginDescriptor == null )
|
||||||
{
|
{
|
||||||
|
@ -161,28 +141,7 @@ public class DefaultBuildPlanner
|
||||||
{
|
{
|
||||||
MojoBinding mojoBinding = (MojoBinding) it.next();
|
MojoBinding mojoBinding = (MojoBinding) it.next();
|
||||||
|
|
||||||
PluginDescriptor pluginDescriptor = null;
|
PluginDescriptor pluginDescriptor = loadPluginDescriptor( mojoBinding, plan, project );
|
||||||
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 );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( pluginDescriptor == null )
|
if ( pluginDescriptor == null )
|
||||||
{
|
{
|
||||||
|
@ -200,24 +159,23 @@ public class DefaultBuildPlanner
|
||||||
{
|
{
|
||||||
List reportBindings = lifecycleBindingManager.getReportBindings( project );
|
List reportBindings = lifecycleBindingManager.getReportBindings( project );
|
||||||
|
|
||||||
for ( Iterator reportBindingIt = reportBindings.iterator(); reportBindingIt.hasNext(); )
|
if ( reportBindings != null )
|
||||||
{
|
{
|
||||||
MojoBinding reportBinding = (MojoBinding) reportBindingIt.next();
|
plan.addForkedExecution( mojoBinding, reportBindings );
|
||||||
|
|
||||||
try
|
for ( Iterator reportBindingIt = reportBindings.iterator(); reportBindingIt.hasNext(); )
|
||||||
{
|
{
|
||||||
pluginLoader.loadReportPlugin( mojoBinding, project );
|
MojoBinding reportBinding = (MojoBinding) reportBindingIt.next();
|
||||||
}
|
|
||||||
catch ( PluginLoaderException e )
|
PluginDescriptor pd = loadPluginDescriptor( reportBinding, plan, project );
|
||||||
{
|
|
||||||
throw new LifecyclePlannerException( "Failed to load report-plugin descriptor for: "
|
if ( pd != null )
|
||||||
+ MojoBindingUtils.toString( reportBinding )
|
{
|
||||||
+ ". Reason: " + e.getMessage(), e );
|
findForkModifiers( reportBinding, pluginDescriptor, plan, project );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plan.addForkedExecution( mojoBinding, reportBindings );
|
|
||||||
|
|
||||||
// NOTE: the first sighting of a mojo requiring reports should satisfy this condition.
|
// NOTE: the first sighting of a mojo requiring reports should satisfy this condition.
|
||||||
// therefore, we can break out as soon as we find one.
|
// therefore, we can break out as soon as we find one.
|
||||||
break;
|
break;
|
||||||
|
@ -225,6 +183,35 @@ public class DefaultBuildPlanner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private PluginDescriptor loadPluginDescriptor( final MojoBinding mojoBinding, final BuildPlan plan,
|
||||||
|
final MavenProject project )
|
||||||
|
{
|
||||||
|
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 );
|
||||||
|
}
|
||||||
|
|
||||||
|
return pluginDescriptor;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Explores a single MojoBinding, and injects any necessary plan modifiers to accommodate any of the three types of
|
* Explores a single MojoBinding, and injects any necessary plan modifiers to accommodate any of the three types of
|
||||||
* forked execution, along with any new mojos/lifecycles that entails.
|
* forked execution, along with any new mojos/lifecycles that entails.
|
||||||
|
|
Loading…
Reference in New Issue