String executePhase = execute.getNamedParameter( JavaMojoAnnotation.EXECUTE_PHASE );
String executeGoal = execute.getNamedParameter( JavaMojoAnnotation.EXECUTE_GOAL );
if ( executePhase == null && executeGoal == null )
{
throw new InvalidPluginDescriptorException( javaClass.getFullyQualifiedName()
+ ": @execute tag requires either a 'phase' or 'goal' parameter" );
}
else if ( executePhase != null && executeGoal != null )
{
throw new InvalidPluginDescriptorException( javaClass.getFullyQualifiedName()
+ ": @execute tag can have only one of a 'phase' or 'goal' parameter" );
}
mojoDescriptor.setExecutePhase( executePhase );
mojoDescriptor.setExecuteGoal( executeGoal );
String lifecycle = execute.getNamedParameter( JavaMojoAnnotation.EXECUTE_LIFECYCLE );
if ( lifecycle != null )
{
mojoDescriptor.setExecuteLifecycle( lifecycle );
if ( mojoDescriptor.getExecuteGoal() != null )
{
throw new InvalidPluginDescriptorException( javaClass.getFullyQualifiedName()
+ ": @execute lifecycle requires a phase instead of a goal" );
}
}
}