if ( lifecycle == null )
{
throw new MojoExecutionException( "The given phase '" + cmd + "' is an unknown phase." );
}
LifecycleMapping lifecycleMapping =
(LifecycleMapping) session.lookup( LifecycleMapping.ROLE, project.getPackaging() );
@SuppressWarnings( "unchecked" )
List<String> phases = lifecycle.getPhases();
if ( lifecycle.getDefaultPhases() == null )
{
descriptionBuffer.append( "'" + cmd + "' is a phase corresponding to this plugin:\n" );
for ( String key : phases )
{
if ( !key.equals( cmd ) )
{
continue;
}
if ( lifecycleMapping.getPhases( "default" ).get( key ) != null )
{
descriptionBuffer.append( lifecycleMapping.getPhases( "default" ).get( key ) );
descriptionBuffer.append( "\n" );
}
}
descriptionBuffer.append( "\n" );
descriptionBuffer.append(
"It is a part of the lifecycle for the POM packaging '" + project.getPackaging()
+ "'. This lifecycle includes the following phases:" );
descriptionBuffer.append( "\n" );
for ( String key : phases )
{
descriptionBuffer.append( "* " + key + ": " );
String value = (String) lifecycleMapping.getPhases( "default" ).get( key );
if ( StringUtils.isNotEmpty( value ) )
{
for ( StringTokenizer tok = new StringTokenizer( value, "," ); tok.hasMoreTokens(); )
{
descriptionBuffer.append( tok.nextToken().trim() );