use of org.gradle.api.artifacts.ResolveException in project gradle by gradle.
the class DependencyResolvingClasspath method getBuildDependencies.
@Override
public TaskDependency getBuildDependencies() {
ensureResolved(false);
final List<Object> taskDependencies = new ArrayList<Object>();
final List<Throwable> failures = new ArrayList<Throwable>();
resolveResult.artifactsResults.getArtifacts().collectBuildDependencies(new BuildDependenciesVisitor() {
@Override
public void visitDependency(Object dep) {
taskDependencies.add(dep);
}
@Override
public void visitFailure(Throwable failure) {
failures.add(failure);
}
});
if (!failures.isEmpty()) {
throw new ResolveException(getDisplayName(), failures);
}
return TaskDependencies.of(taskDependencies);
}
use of org.gradle.api.artifacts.ResolveException in project gradle by gradle.
the class ErrorHandlingConfigurationResolver method resolveGraph.
@Override
public void resolveGraph(ConfigurationInternal configuration, ResolverResults results) throws ResolveException {
try {
delegate.resolveGraph(configuration, results);
} catch (Exception e) {
results.failed(wrapException(e, configuration));
BrokenResolvedConfiguration broken = new BrokenResolvedConfiguration(e, configuration);
results.artifactsResolved(broken, broken);
return;
}
ResolutionResult wrappedResult = new ErrorHandlingResolutionResult(results.getResolutionResult(), configuration);
results.graphResolved(wrappedResult, results.getResolvedLocalComponents(), results.getVisitedArtifacts());
}
use of org.gradle.api.artifacts.ResolveException in project gradle by gradle.
the class PluginResolutionServiceResolver method resolvePluginDependencies.
private ClassPath resolvePluginDependencies(final PluginUseMetaData metadata) {
DependencyResolutionServices resolution = dependencyResolutionServicesFactory.create();
RepositoryHandler repositories = resolution.getResolveRepositoryHandler();
final String repoUrl = metadata.implementation.get("repo");
repositories.maven(new Action<MavenArtifactRepository>() {
public void execute(MavenArtifactRepository mavenArtifactRepository) {
mavenArtifactRepository.setUrl(repoUrl);
}
});
Dependency dependency = resolution.getDependencyHandler().create(metadata.implementation.get("gav"));
ConfigurationContainerInternal configurations = (ConfigurationContainerInternal) resolution.getConfigurationContainer();
ConfigurationInternal configuration = configurations.detachedConfiguration(dependency);
try {
Set<File> files = configuration.getResolvedConfiguration().getFiles(Specs.satisfyAll());
return new DefaultClassPath(files);
} catch (ResolveException e) {
throw new DependencyResolutionException("Failed to resolve all plugin dependencies from " + repoUrl, e.getCause());
}
}
use of org.gradle.api.artifacts.ResolveException in project gradle by gradle.
the class DownloadingScalaToolChain method select.
@Override
public ToolProvider select(ScalaPlatform targetPlatform) {
try {
Configuration scalaClasspath = resolveDependency("org.scala-lang:scala-compiler:" + targetPlatform.getScalaVersion());
Configuration zincClasspath = resolveDependency("com.typesafe.zinc:zinc:" + DefaultScalaToolProvider.DEFAULT_ZINC_VERSION);
Set<File> resolvedScalaClasspath = scalaClasspath.resolve();
Set<File> resolvedZincClasspath = zincClasspath.resolve();
return new DefaultScalaToolProvider(gradleUserHomeDir, daemonWorkingDir, workerDaemonFactory, fileResolver, resolvedScalaClasspath, resolvedZincClasspath);
} catch (ResolveException resolveException) {
return new NotFoundScalaToolProvider(resolveException);
}
}
use of org.gradle.api.artifacts.ResolveException in project gradle by gradle.
the class ErrorHandlingConfigurationResolver method resolveArtifacts.
@Override
public void resolveArtifacts(ConfigurationInternal configuration, ResolverResults results) throws ResolveException {
try {
delegate.resolveArtifacts(configuration, results);
} catch (Exception e) {
BrokenResolvedConfiguration broken = new BrokenResolvedConfiguration(e, configuration);
results.artifactsResolved(broken, broken);
return;
}
ResolvedConfiguration wrappedConfiguration = new ErrorHandlingResolvedConfiguration(results.getResolvedConfiguration(), configuration);
results.artifactsResolved(wrappedConfiguration, results.getVisitedArtifacts());
}
Aggregations