o Made plugin manager bail out if requested mojo can't be loaded to save clients from NPEs

git-svn-id: https://svn.apache.org/repos/asf/maven/components/branches/MNG-2766@774885 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Benjamin Bentmann 2009-05-14 19:13:45 +00:00
parent 7ccc3d878e
commit 3e287c47bb
1 changed files with 7 additions and 1 deletions

View File

@ -493,13 +493,19 @@ public class DefaultPluginManager
} }
} }
public MojoDescriptor getMojoDescriptor( Plugin plugin, String goal, ArtifactRepository localRepository, List<ArtifactRepository> remoteRepositories ) public MojoDescriptor getMojoDescriptor( Plugin plugin, String goal, ArtifactRepository localRepository,
List<ArtifactRepository> remoteRepositories )
throws PluginLoaderException throws PluginLoaderException
{ {
PluginDescriptor pluginDescriptor = loadPlugin( plugin, localRepository, remoteRepositories ); PluginDescriptor pluginDescriptor = loadPlugin( plugin, localRepository, remoteRepositories );
MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( goal ); MojoDescriptor mojoDescriptor = pluginDescriptor.getMojo( goal );
if ( mojoDescriptor == null )
{
throw new PluginLoaderException( plugin, "Failed to load plugin mojo. Reason: Unknown mojo: " + goal );
}
return mojoDescriptor; return mojoDescriptor;
} }