Try to assume that a plugin bound in the POM but not resolved during build-plan-building will be resolvable later.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@545558 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2007-06-08 16:46:20 +00:00
parent 17e4709531
commit 19311574e1
4 changed files with 40 additions and 33 deletions

View File

@ -275,20 +275,38 @@ public class DefaultLifecycleBindingManager
}
catch ( PluginLoaderException e )
{
throw new LifecycleLoaderException( "Failed to load plugin: " + plugin
+ ". Reason: " + e.getMessage(), e );
mojoBinding.setLateBound( true );
String message = "Failed to load plugin descriptor for: "
+ plugin
+ ". Assigning this plugin to be resolved again just prior to its execution. "
+ "NOTE, This may affect assignment of the mojo: "
+ mojoBinding.getGoal()
+ " if its default phase (given in the plugin descriptor) is used.";
if ( logger.isDebugEnabled() )
{
logger.debug( message, e );
}
else
{
logger.warn( message + " Check debug output (-X) for more information." );
}
}
}
if ( pluginDescriptor.getMojos() == null )
if ( pluginDescriptor != null )
{
logger.error( "Somehow, the PluginDescriptor for plugin: " + plugin.getKey()
+ " contains no mojos. This is highly irregular. Ignoring..." );
continue;
}
if ( pluginDescriptor.getMojos() == null )
{
logger.error( "Somehow, the PluginDescriptor for plugin: " + plugin.getKey()
+ " contains no mojos. This is highly irregular. Ignoring..." );
continue;
}
MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( goal );
phase = mojoDescriptor.getPhase();
MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( goal );
phase = mojoDescriptor.getPhase();
}
if ( phase == null )
{

View File

@ -27,8 +27,6 @@ public class BuildPlan
private final Map forkedPhases;
private final List lateBoundMojos;
private List renderedLifecycleMojos = new ArrayList();
private final Map directInvocationBindings;
@ -47,17 +45,15 @@ public class BuildPlan
this.tasks = tasks;
forkedDirectInvocations = new HashMap();
forkedPhases = new HashMap();
lateBoundMojos = new ArrayList();
directInvocationBindings = new HashMap();
}
private BuildPlan( final LifecycleBindings bindings, final Map forkedDirectInvocations, final Map forkedPhases, final List lateBoundMojos,
private BuildPlan( final LifecycleBindings bindings, final Map forkedDirectInvocations, final Map forkedPhases,
final Map directInvocationBindings, final List tasks )
{
this.bindings = LifecycleUtils.cloneBindings( bindings );
this.forkedDirectInvocations = new HashMap( forkedDirectInvocations );
this.forkedPhases = new HashMap( forkedPhases );
this.lateBoundMojos = new ArrayList( lateBoundMojos );
this.tasks = tasks;
this.directInvocationBindings = new HashMap( directInvocationBindings );
}
@ -94,11 +90,6 @@ public class BuildPlan
directInvocationBindings.put( key, binding );
}
public List getLateBoundMojos()
{
return lateBoundMojos;
}
public Map getDirectInvocationBindings()
{
return directInvocationBindings;
@ -136,14 +127,9 @@ public class BuildPlan
invoke.addAll( forkedInvocations );
}
public void addLateBoundMojo( final MojoBinding mojoBinding )
{
lateBoundMojos.add( MojoBindingUtils.createMojoBindingKey( mojoBinding, false ) );
}
public BuildPlan copy( final List newTasks )
{
return new BuildPlan( bindings, forkedDirectInvocations, forkedPhases, lateBoundMojos, directInvocationBindings, newTasks );
return new BuildPlan( bindings, forkedDirectInvocations, forkedPhases, directInvocationBindings, newTasks );
}
public void resetExecutionProgress()
@ -214,8 +200,7 @@ public class BuildPlan
private void addResolverIfLateBound( final MojoBinding mojoBinding, final List plan )
{
String key = MojoBindingUtils.createMojoBindingKey( mojoBinding, false );
if ( lateBoundMojos.contains( key ) )
if ( mojoBinding.isLateBound() )
{
MojoBinding resolveBinding = StateManagementUtils.createResolveLateBoundMojoBinding( mojoBinding );
plan.add( resolveBinding );

View File

@ -209,7 +209,7 @@ public class DefaultBuildPlanner
logger.warn( message );
}
plan.addLateBoundMojo( mojoBinding );
mojoBinding.setLateBound( true );
}
return pluginDescriptor;

View File

@ -619,20 +619,24 @@
<type>boolean</type>
</field>
</fields>
<!--
<codeSegments>
<codeSegment>
<version>1.0.0</version>
<code><![CDATA[
public String toString()
private boolean lateBound = false;
public boolean isLateBound()
{
return getGroupId() + ":" + getArtifactId() + ":" + getVersion() + ":" + getGoal() + ":" + getExecutionId();
return lateBound;
}
public void setLateBound( boolean lateBound )
{
this.lateBound = lateBound;
}
]]></code>
</codeSegment>
</codeSegments>
-->
</class>
</classes>
</model>