throws PluginConfigurationException, ArtifactNotFoundException, PluginManagerException,
ArtifactResolutionException
{
MojoDescriptor mojoDescriptor = mojoExecution.getMojoDescriptor();
PluginDescriptor pluginDescriptor = mojoDescriptor.getPluginDescriptor();
PlexusContainer pluginContainer = getPluginContainer( pluginDescriptor );
// if this is the first time this plugin has been used, the plugin's container will only
// contain the plugin's artifact in isolation; we need to finish resolving the plugin's
// dependencies, and add them to the container.
ensurePluginContainerIsComplete( pluginDescriptor, pluginContainer, project, session );
Mojo plugin;
try
{
plugin = (Mojo) pluginContainer.lookup( Mojo.ROLE, mojoDescriptor.getRoleHint() );
if ( report && !( plugin instanceof MavenReport ) )
{
// TODO: the mojoDescriptor should actually capture this information so we don't get this far
return null;
}
}
catch ( ComponentLookupException e )
{
Throwable cause = e.getCause();
while( cause != null && !(cause instanceof NoClassDefFoundError ) )
{
cause = cause.getCause();
}
if ( cause != null && ( cause instanceof NoClassDefFoundError ) )
{
throw new PluginManagerException( "Unable to load the mojo '" + mojoDescriptor.getRoleHint()
+ "' in the plugin '" + pluginDescriptor.getPluginLookupKey() + "'. A required class is missing: "
+ cause.getMessage(), e );
}
throw new PluginManagerException( "Unable to find the mojo '" + mojoDescriptor.getGoal() +
"' (or one of its required components) in the plugin '" + pluginDescriptor.getPluginLookupKey() + "'", e );
}
catch ( NoClassDefFoundError e )
{
throw new PluginManagerException( "Unable to load the mojo '" + mojoDescriptor.getRoleHint()
+ "' in the plugin '" + pluginDescriptor.getPluginLookupKey() + "'. A required class is missing: "
+ e.getMessage(), e );
}
if ( plugin instanceof ContextEnabled )
{