List of usage examples for org.apache.maven.artifact.metadata ArtifactMetadataRetrievalException ArtifactMetadataRetrievalException
@Deprecated
public ArtifactMetadataRetrievalException(String message, Throwable cause)
From source file:org.codehaus.mojo.pomtools.helpers.MetadataHelper.java
License:Apache License
public RepositoryMetadata getMetadata(Artifact artifact) throws ArtifactMetadataRetrievalException { RepositoryMetadata metadata = new ArtifactRepositoryMetadata(artifact); try {/*from w w w . ja v a 2s. co m*/ repositoryMetadataManager.resolve(metadata, remoteRepositories, localRepository); return metadata; } catch (RepositoryMetadataResolutionException e) { throw new ArtifactMetadataRetrievalException("An error occured while resolving repository metadata", e); } }
From source file:org.codehaus.mojo.versions.api.DefaultVersionsHelper.java
License:Apache License
/** * {@inheritDoc}/* ww w. j a v a2 s.co m*/ */ public Map<Dependency, ArtifactVersions> lookupDependenciesUpdates(Set dependencies, boolean usePluginRepositories) throws ArtifactMetadataRetrievalException, InvalidVersionSpecificationException { // Create the request for details collection for parallel lookup... final List<Callable<DependencyArtifactVersions>> requestsForDetails = new ArrayList<Callable<DependencyArtifactVersions>>( dependencies.size()); for (final Object dependency1 : dependencies) { final Dependency dependency = (Dependency) dependency1; requestsForDetails.add(new DependencyLookup(dependency, usePluginRepositories)); } final Map<Dependency, ArtifactVersions> dependencyUpdates = new TreeMap<Dependency, ArtifactVersions>( new DependencyComparator()); // Lookup details in parallel... final ExecutorService executor = Executors.newFixedThreadPool(LOOKUP_PARALLEL_THREADS); try { final List<Future<DependencyArtifactVersions>> responseForDetails = executor .invokeAll(requestsForDetails); // Construct the final results... for (final Future<DependencyArtifactVersions> details : responseForDetails) { final DependencyArtifactVersions dav = details.get(); dependencyUpdates.put(dav.getDependency(), dav.getArtifactVersions()); } } catch (final ExecutionException ee) { throw new ArtifactMetadataRetrievalException( "Unable to acquire metadata for dependencies " + dependencies + ": " + ee.getMessage(), ee); } catch (final InterruptedException ie) { throw new ArtifactMetadataRetrievalException( "Unable to acquire metadata for dependencies " + dependencies + ": " + ie.getMessage(), ie); } finally { executor.shutdownNow(); } return dependencyUpdates; }
From source file:org.codehaus.mojo.versions.api.DefaultVersionsHelper.java
License:Apache License
/** * {@inheritDoc}// w ww . j ava 2s . c o m */ public Map<Plugin, PluginUpdatesDetails> lookupPluginsUpdates(Set<Plugin> plugins, Boolean allowSnapshots) throws ArtifactMetadataRetrievalException, InvalidVersionSpecificationException { // Create the request for details collection for parallel lookup... final List<Callable<PluginPluginUpdatesDetails>> requestsForDetails = new ArrayList<Callable<PluginPluginUpdatesDetails>>( plugins.size()); for (final Plugin plugin : plugins) { requestsForDetails.add(new PluginLookup(plugin, allowSnapshots)); } final Map<Plugin, PluginUpdatesDetails> pluginUpdates = new TreeMap<Plugin, PluginUpdatesDetails>( new PluginComparator()); // Lookup details in parallel... final ExecutorService executor = Executors.newFixedThreadPool(LOOKUP_PARALLEL_THREADS); try { final List<Future<PluginPluginUpdatesDetails>> responseForDetails = executor .invokeAll(requestsForDetails); // Construct the final results... for (final Future<PluginPluginUpdatesDetails> details : responseForDetails) { final PluginPluginUpdatesDetails pud = details.get(); pluginUpdates.put(pud.getPlugin(), pud.getPluginUpdatesDetails()); } } catch (final ExecutionException ee) { throw new ArtifactMetadataRetrievalException( "Unable to acquire metadata for plugins " + plugins + ": " + ee.getMessage(), ee); } catch (final InterruptedException ie) { throw new ArtifactMetadataRetrievalException( "Unable to acquire metadata for plugins " + plugins + ": " + ie.getMessage(), ie); } finally { executor.shutdownNow(); } return pluginUpdates; }