private void populatePluginFields( Object mojo, MojoDescriptor mojoDescriptor, ClassRealm pluginRealm,
PlexusConfiguration configuration, ExpressionEvaluator expressionEvaluator )
throws PluginConfigurationException
{
ComponentConfigurator configurator = null;
String configuratorId = mojoDescriptor.getComponentConfigurator();
if ( StringUtils.isEmpty( configuratorId ) )
{
configuratorId = "basic";
}
try
{
// TODO: could the configuration be passed to lookup and the configurator known to plexus via the descriptor
// so that this method could entirely be handled by a plexus lookup?
configurator = container.lookup( ComponentConfigurator.class, configuratorId );
ConfigurationListener listener = new DebugConfigurationListener( logger );
logger.debug( "Configuring mojo '" + mojoDescriptor.getId() + "' with " + configuratorId
+ " configurator -->" );
configurator.configureComponent( mojo, configuration, expressionEvaluator, pluginRealm, listener );
logger.debug( "-- end configuration --" );
}
catch ( ComponentConfigurationException e )
{