You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by br...@apache.org on 2005/09/22 08:58:20 UTC

svn commit: r290899 - /maven/components/trunk/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java

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: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org