{
WerkzProject project = getProject();
if ( project == null )
{
throw new JellyTagException( "No Project available" );
}
invokeBody( output );
try
{
// Lazy goal loading
Session session = createSession();
MavenJellyContext baseContext = (MavenJellyContext) session.getAttribute( PluginManager.BASE_CONTEXT );
GoalToJellyScriptHousingMapper mapper = (GoalToJellyScriptHousingMapper) session
.getAttribute( PluginManager.GOAL_MAPPER );
PluginManager pluginManager = (PluginManager) session.getAttribute( PluginManager.PLUGIN_MANAGER );
Set pluginSet;
try
{
pluginSet = pluginManager.prepAttainGoal( getName(), baseContext, mapper );
}
catch ( Exception e )
{
throw new JellyTagException( e );
}
project.attainGoal( getName(), session );
pluginManager.addDelayedPops( pluginSet );
}
catch ( UnattainableGoalException e )
{
Throwable root = e.getRootCause();
if ( root != null )
{
if ( root instanceof JellyTagException )
{
throw (JellyTagException) root;
}
if ( root instanceof UnattainableGoalException )
{
throw new JellyTagException( e );
}
}
e.fillInStackTrace();
throw new JellyTagException( e );
}
catch ( NoActionDefinitionException e )
{
throw new JellyTagException( e );
}
catch ( NoSuchGoalException e )
{
throw new JellyTagException( e );
}
}