mirror of https://github.com/apache/maven.git
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:
parent
17e4709531
commit
19311574e1
|
@ -275,11 +275,28 @@ public class DefaultLifecycleBindingManager
|
||||||
}
|
}
|
||||||
catch ( PluginLoaderException e )
|
catch ( PluginLoaderException e )
|
||||||
{
|
{
|
||||||
throw new LifecycleLoaderException( "Failed to load plugin: " + plugin
|
mojoBinding.setLateBound( true );
|
||||||
+ ". Reason: " + e.getMessage(), e );
|
|
||||||
|
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 != null )
|
||||||
|
{
|
||||||
if ( pluginDescriptor.getMojos() == null )
|
if ( pluginDescriptor.getMojos() == null )
|
||||||
{
|
{
|
||||||
logger.error( "Somehow, the PluginDescriptor for plugin: " + plugin.getKey()
|
logger.error( "Somehow, the PluginDescriptor for plugin: " + plugin.getKey()
|
||||||
|
@ -289,6 +306,7 @@ public class DefaultLifecycleBindingManager
|
||||||
|
|
||||||
MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( goal );
|
MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( goal );
|
||||||
phase = mojoDescriptor.getPhase();
|
phase = mojoDescriptor.getPhase();
|
||||||
|
}
|
||||||
|
|
||||||
if ( phase == null )
|
if ( phase == null )
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,8 +27,6 @@ public class BuildPlan
|
||||||
|
|
||||||
private final Map forkedPhases;
|
private final Map forkedPhases;
|
||||||
|
|
||||||
private final List lateBoundMojos;
|
|
||||||
|
|
||||||
private List renderedLifecycleMojos = new ArrayList();
|
private List renderedLifecycleMojos = new ArrayList();
|
||||||
|
|
||||||
private final Map directInvocationBindings;
|
private final Map directInvocationBindings;
|
||||||
|
@ -47,17 +45,15 @@ public class BuildPlan
|
||||||
this.tasks = tasks;
|
this.tasks = tasks;
|
||||||
forkedDirectInvocations = new HashMap();
|
forkedDirectInvocations = new HashMap();
|
||||||
forkedPhases = new HashMap();
|
forkedPhases = new HashMap();
|
||||||
lateBoundMojos = new ArrayList();
|
|
||||||
directInvocationBindings = new HashMap();
|
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 )
|
final Map directInvocationBindings, final List tasks )
|
||||||
{
|
{
|
||||||
this.bindings = LifecycleUtils.cloneBindings( bindings );
|
this.bindings = LifecycleUtils.cloneBindings( bindings );
|
||||||
this.forkedDirectInvocations = new HashMap( forkedDirectInvocations );
|
this.forkedDirectInvocations = new HashMap( forkedDirectInvocations );
|
||||||
this.forkedPhases = new HashMap( forkedPhases );
|
this.forkedPhases = new HashMap( forkedPhases );
|
||||||
this.lateBoundMojos = new ArrayList( lateBoundMojos );
|
|
||||||
this.tasks = tasks;
|
this.tasks = tasks;
|
||||||
this.directInvocationBindings = new HashMap( directInvocationBindings );
|
this.directInvocationBindings = new HashMap( directInvocationBindings );
|
||||||
}
|
}
|
||||||
|
@ -94,11 +90,6 @@ public class BuildPlan
|
||||||
directInvocationBindings.put( key, binding );
|
directInvocationBindings.put( key, binding );
|
||||||
}
|
}
|
||||||
|
|
||||||
public List getLateBoundMojos()
|
|
||||||
{
|
|
||||||
return lateBoundMojos;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map getDirectInvocationBindings()
|
public Map getDirectInvocationBindings()
|
||||||
{
|
{
|
||||||
return directInvocationBindings;
|
return directInvocationBindings;
|
||||||
|
@ -136,14 +127,9 @@ public class BuildPlan
|
||||||
invoke.addAll( forkedInvocations );
|
invoke.addAll( forkedInvocations );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addLateBoundMojo( final MojoBinding mojoBinding )
|
|
||||||
{
|
|
||||||
lateBoundMojos.add( MojoBindingUtils.createMojoBindingKey( mojoBinding, false ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
public BuildPlan copy( final List newTasks )
|
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()
|
public void resetExecutionProgress()
|
||||||
|
@ -214,8 +200,7 @@ public class BuildPlan
|
||||||
|
|
||||||
private void addResolverIfLateBound( final MojoBinding mojoBinding, final List plan )
|
private void addResolverIfLateBound( final MojoBinding mojoBinding, final List plan )
|
||||||
{
|
{
|
||||||
String key = MojoBindingUtils.createMojoBindingKey( mojoBinding, false );
|
if ( mojoBinding.isLateBound() )
|
||||||
if ( lateBoundMojos.contains( key ) )
|
|
||||||
{
|
{
|
||||||
MojoBinding resolveBinding = StateManagementUtils.createResolveLateBoundMojoBinding( mojoBinding );
|
MojoBinding resolveBinding = StateManagementUtils.createResolveLateBoundMojoBinding( mojoBinding );
|
||||||
plan.add( resolveBinding );
|
plan.add( resolveBinding );
|
||||||
|
|
|
@ -209,7 +209,7 @@ public class DefaultBuildPlanner
|
||||||
logger.warn( message );
|
logger.warn( message );
|
||||||
}
|
}
|
||||||
|
|
||||||
plan.addLateBoundMojo( mojoBinding );
|
mojoBinding.setLateBound( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
return pluginDescriptor;
|
return pluginDescriptor;
|
||||||
|
|
|
@ -619,20 +619,24 @@
|
||||||
<type>boolean</type>
|
<type>boolean</type>
|
||||||
</field>
|
</field>
|
||||||
</fields>
|
</fields>
|
||||||
<!--
|
|
||||||
<codeSegments>
|
<codeSegments>
|
||||||
<codeSegment>
|
<codeSegment>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
<code><![CDATA[
|
<code><![CDATA[
|
||||||
|
private boolean lateBound = false;
|
||||||
|
|
||||||
public String toString()
|
public boolean isLateBound()
|
||||||
{
|
{
|
||||||
return getGroupId() + ":" + getArtifactId() + ":" + getVersion() + ":" + getGoal() + ":" + getExecutionId();
|
return lateBound;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLateBound( boolean lateBound )
|
||||||
|
{
|
||||||
|
this.lateBound = lateBound;
|
||||||
}
|
}
|
||||||
]]></code>
|
]]></code>
|
||||||
</codeSegment>
|
</codeSegment>
|
||||||
</codeSegments>
|
</codeSegments>
|
||||||
-->
|
|
||||||
</class>
|
</class>
|
||||||
</classes>
|
</classes>
|
||||||
</model>
|
</model>
|
||||||
|
|
Loading…
Reference in New Issue