try
{
// get the various expressions out of the helper.
project = (MavenProject) helper.evaluate( "${project}" );
LifecycleExecutor life;
life = (LifecycleExecutor) helper.getComponent( LifecycleExecutor.class );
// The lifecycle API changed from Maven 2 to 3 so we have to do a hack to figure
// out which one we're using.
Field field = ReflectionUtils.getFieldByNameIncludingSuperclasses( "defaultLifeCycles", life.getClass() );
if (field != null) // Using Maven 3
{
Object defaultLifeCycles = ReflectionUtils.getValueIncludingSuperclasses("defaultLifeCycles", life);
Map lifecyclesMap = (Map)ReflectionUtils.getValueIncludingSuperclasses("lifecycles", defaultLifeCycles);
lifecycles = lifecyclesMap.values();