PluginNotFoundException, PluginResolutionException, NoPluginFoundForPrefixException,
InvalidPluginDescriptorException, PluginVersionResolutionException
{
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
String forkedLifecycle = mojoDescriptor.getExecuteLifecycle();
if ( StringUtils.isEmpty( forkedLifecycle ) )
{
return;
}
org.apache.maven.plugin.lifecycle.Lifecycle lifecycleOverlay;
try
{
lifecycleOverlay = pluginDescriptor.getLifecycleMapping( forkedLifecycle );
}
catch ( IOException e )
{
throw new PluginDescriptorParsingException( pluginDescriptor.getPlugin(), pluginDescriptor.getSource(), e );
}
catch ( XmlPullParserException e )
{
throw new PluginDescriptorParsingException( pluginDescriptor.getPlugin(), pluginDescriptor.getSource(), e );
}
if ( lifecycleOverlay == null )
{
throw new LifecycleNotFoundException( forkedLifecycle );
}
for ( Phase phase : lifecycleOverlay.getPhases() )
{
List<MojoExecution> forkedExecutions = lifecycleMappings.get( phase.getId() );
if ( forkedExecutions != null )
{
for ( Execution execution : phase.getExecutions() )
{
for ( String goal : execution.getGoals() )
{
MojoDescriptor forkedMojoDescriptor;
if ( goal.indexOf( ':' ) < 0 )
{
forkedMojoDescriptor = pluginDescriptor.getMojo( goal );
if ( forkedMojoDescriptor == null )
{
throw new MojoNotFoundException( goal, pluginDescriptor );
}
}