diff --git a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java index feae80bc5d..ddbe266767 100644 --- a/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java +++ b/maven-core/src/main/java/org/apache/maven/plugin/DefaultPluginManager.java @@ -493,13 +493,19 @@ public class DefaultPluginManager } } - public MojoDescriptor getMojoDescriptor( Plugin plugin, String goal, ArtifactRepository localRepository, List remoteRepositories ) + public MojoDescriptor getMojoDescriptor( Plugin plugin, String goal, ArtifactRepository localRepository, + List remoteRepositories ) throws PluginLoaderException { PluginDescriptor pluginDescriptor = loadPlugin( plugin, localRepository, remoteRepositories ); MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( goal ); + if ( mojoDescriptor == null ) + { + throw new PluginLoaderException( plugin, "Failed to load plugin mojo. Reason: Unknown mojo: " + goal ); + } + return mojoDescriptor; }