diff --git a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java index a096ce3378..a9c37b0a89 100644 --- a/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java +++ b/maven-core/src/main/java/org/apache/maven/lifecycle/DefaultLifecycleExecutor.java @@ -211,7 +211,12 @@ public class DefaultLifecycleExecutor { pluginManager.verifyPluginForGoal( task, session ); mojoDescriptor = pluginManager.getMojoDescriptor( task ); - if ( mojoDescriptor != null && mojoDescriptor.getPhase() != null ) + if ( mojoDescriptor == null ) + { + throw new LifecycleExecutionException( "Required goal not found: " + task ); + } + + if ( mojoDescriptor.getPhase() != null ) { Phase phase = (Phase) phaseMap.get( mojoDescriptor.getPhase() ); phase.getGoals().add( task );