use of org.eclipse.aether.resolution.ArtifactResolutionException in project spring-boot by spring-projects.
the class MavenResolverGrapeEngine method resolve.
private List<File> resolve(List<Dependency> dependencies) throws ArtifactResolutionException {
try {
CollectRequest collectRequest = getCollectRequest(dependencies);
DependencyRequest dependencyRequest = getDependencyRequest(collectRequest);
DependencyResult result = this.repositorySystem.resolveDependencies(this.session, dependencyRequest);
addManagedDependencies(result);
return getFiles(result);
} catch (Exception ex) {
throw new DependencyResolutionFailedException(ex);
} finally {
this.progressReporter.finished();
}
}
use of org.eclipse.aether.resolution.ArtifactResolutionException in project grails-maven by grails.
the class AbstractGrailsMojo method resolveArtifactIds.
protected Collection<File> resolveArtifactIds(Collection<String> artifactIds) throws MojoExecutionException {
Collection<ArtifactRequest> requests = new ArrayList<ArtifactRequest>();
for (String artifactId : artifactIds) {
ArtifactRequest request = new ArtifactRequest();
request.setArtifact(new DefaultArtifact(artifactId));
request.setRepositories(remoteRepos);
getLog().debug("Resolving artifact " + artifactId + " from " + remoteRepos);
requests.add(request);
}
Collection<File> files = new ArrayList<File>();
try {
List<ArtifactResult> result = repoSystem.resolveArtifacts(repoSession, requests);
for (ArtifactResult artifactResult : result) {
File file = artifactResult.getArtifact().getFile();
files.add(file);
getLog().debug("Resolved artifact " + artifactResult.getArtifact().getArtifactId() + " to " + file + " from " + artifactResult.getRepository());
}
} catch (ArtifactResolutionException e) {
throw new MojoExecutionException(e.getMessage(), e);
}
return files;
}
use of org.eclipse.aether.resolution.ArtifactResolutionException in project project-build-plugin by axonivy.
the class MavenEngineDownloader method resolveArtifact.
private ArtifactResult resolveArtifact() throws MojoExecutionException {
final ArtifactRequest artifactRequest = new ArtifactRequest();
artifactRequest.setArtifact(engineArtifact);
artifactRequest.setRepositories(pluginRepositories);
try {
return repositorySystem.resolveArtifact(repositorySession, artifactRequest);
} catch (ArtifactResolutionException e) {
throw new MojoExecutionException("Failed to resolve artifact " + artifactRequest + "!", e);
}
}
use of org.eclipse.aether.resolution.ArtifactResolutionException in project acceptance-test-harness by jenkinsci.
the class TSRPluginManager method installPlugins.
/**
* Installs specified plugins.
*
* deprecated Please be encouraged to use {@link WithPlugins} annotations to statically declare
* the required plugins you need. If you really do need to install plugins in the middle
* of a test, as opposed to be in the beginning, then this is the right method.
* <p/>
* The deprecation marker is to call attention to {@link WithPlugins}. This method
* is not really deprecated.
*/
@Deprecated
public void installPlugins(final String... specs) {
final Map<String, String> candidates = getMapShortNamesVersion(specs);
if (uploadPlugins) {
for (PluginMetadata newPlugin : ucmd.get().transitiveDependenciesOf(candidates.keySet())) {
final String name = newPlugin.name;
final String claimedVersion = candidates.get(name);
String currentSpec;
if (StringUtils.isNotEmpty(claimedVersion)) {
currentSpec = name + "@" + claimedVersion;
} else {
currentSpec = name;
}
if (!isInstalled(currentSpec)) {
// we need to override existing "old" plugins
try {
newPlugin.uploadTo(jenkins, injector, null);
} catch (IOException | ArtifactResolutionException e) {
throw new AssertionError("Failed to upload plugin: " + newPlugin, e);
}
}
}
// TODO: Use better detection if this is actually necessary
try {
waitForCond(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
return isInstalled(specs);
}
}, 5);
} catch (TimeoutException e) {
jenkins.restart();
}
} else {
if (!updated)
checkForUpdates();
OUTER: for (final String n : candidates.keySet()) {
for (int attempt = 0; attempt < 2; attempt++) {
// # of installations attempted, considering retries
visit("available");
check(find(by.xpath("//input[starts-with(@name,'plugin.%s.')]", n)));
clickButton("Install");
sleep(1000);
try {
new UpdateCenter(jenkins).waitForInstallationToComplete(n);
} catch (InstallationFailedException e) {
if (e.getMessage().contains("Failed to download from")) {
// retry
continue;
}
}
// installation completed
continue OUTER;
}
}
}
}
use of org.eclipse.aether.resolution.ArtifactResolutionException in project mule by mulesoft.
the class AetherClassPathClassifier method getArtifactExportedClasses.
/**
* Resolves the exported plugin classes from the given {@link Artifact}
*
* @param exporterArtifact {@link Artifact} used to resolve the exported classes
* @param context {@link ClassPathClassifierContext} with settings for the classification process
* @param rootArtifactRemoteRepositories remote repositories defined by the rootArtifact
* @return {@link List} of {@link Class} that the given {@link Artifact} exports
*/
private List<Class> getArtifactExportedClasses(Artifact exporterArtifact, ClassPathClassifierContext context, List<RemoteRepository> rootArtifactRemoteRepositories) {
final AtomicReference<URL> artifactUrl = new AtomicReference<>();
try {
artifactUrl.set(dependencyResolver.resolveArtifact(exporterArtifact, rootArtifactRemoteRepositories).getArtifact().getFile().toURI().toURL());
} catch (MalformedURLException | ArtifactResolutionException e) {
throw new IllegalStateException("Unable to resolve artifact URL", e);
}
Artifact rootArtifact = context.getRootArtifact();
return context.getExportPluginClasses().stream().filter(clazz -> {
boolean isFromCurrentArtifact = clazz.getProtectionDomain().getCodeSource().getLocation().equals(artifactUrl.get());
if (isFromCurrentArtifact && exporterArtifact != rootArtifact) {
logger.warn("Exported class '{}' from plugin '{}' is being used from another artifact, {}", clazz.getSimpleName(), exporterArtifact, rootArtifact);
}
return isFromCurrentArtifact;
}).collect(toList());
}
Aggregations