Author: brett
Date: Wed Sep 21 23:58:15 2005
New Revision: 290899

URL: http://svn.apache.org/viewcvs?rev=290899&view=rev
Log:
PR: MNG-517
improve error reporting on invalid lifecycle goals

Modified:
    
maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java

Modified: 
maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
URL: 
http://svn.apache.org/viewcvs/maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java?rev=290899&r1=290898&r2=290899&view=diff
==============================================================================
--- 
maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
 (original)
+++ 
maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java
 Wed Sep 21 23:58:15 2005
@@ -684,6 +684,23 @@
                     {
                         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() );



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to