ArtifactRepository localRepository )
throws ArtifactResolutionException, PluginVersionResolutionException, ArtifactNotFoundException,
InvalidVersionSpecificationException, InvalidPluginException, PluginManagerException, PluginNotFoundException,
PluginVersionNotFoundException
{
RepositoryRequest repositoryRequest = new DefaultRepositoryRequest();
repositoryRequest.setLocalRepository( localRepository );
repositoryRequest.setRemoteRepositories( project.getPluginArtifactRepositories() );
repositoryRequest.setOffline( settings.isOffline() );
if ( plugin.getVersion() == null )
{
PluginVersionRequest versionRequest = new DefaultPluginVersionRequest( plugin, repositoryRequest );
plugin.setVersion( pluginVersionResolver.resolve( versionRequest ).getVersion() );
}
try
{
return pluginManager.getPluginDescriptor( plugin, repositoryRequest );
}
catch ( PluginResolutionException e )
{
throw new PluginNotFoundException( plugin, repositoryRequest.getRemoteRepositories() );
}
catch ( PluginDescriptorParsingException e )
{
throw new PluginManagerException( plugin, e.getMessage(), e );
}