PR: MNG-517

improve error reporting on invalid lifecycle goals

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@290899 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Leslie Porter 2005-09-22 06:58:15 +00:00
parent a2c8a904cc
commit 12a5cf7169
1 changed files with 17 additions and 0 deletions

View File

@ -684,6 +684,23 @@ public class DefaultLifecycleExecutor
{
String goal = (String) k.next();
MojoDescriptor desc = mojoDescriptor.getPluginDescriptor().getMojo( goal );
if ( desc == null )
{
String message = "Required goal '" + goal + "' not found in plugin '" +
mojoDescriptor.getPluginDescriptor().getGoalPrefix() + "'";
int index = goal.indexOf( ':' );
if ( index >= 0 )
{
String prefix = goal.substring( index + 1 );
if ( prefix.equals( mojoDescriptor.getPluginDescriptor().getGoalPrefix() ) )
{
message = message + " (goals should not be prefixed - try '" + prefix + "')";
}
}
throw new LifecycleExecutionException( message );
}
MojoExecution mojoExecution = new MojoExecution( desc, (Xpp3Dom) e.getConfiguration() );
addToLifecycleMappings( lifecycleMappings, phase.getId(), mojoExecution,
session.getSettings() );