Java 类org.gradle.api.artifacts.ResolveException 实例源码

项目:Reer    文件:PluginResolutionServiceResolver.java   
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());
    }
}
项目:Pushjet-Android    文件:PluginResolutionServiceResolver.java   
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());
    }
}
项目:spotless    文件:TestProvisioner.java   
/**
 * Creates a Provisioner for the given repositories.
 *
 * The first time a project is created, there are ~7 seconds of configuration
 * which will go away for all subsequent runs.
 *
 * Every call to resolve will take about 1 second, even when all artifacts are resolved.
 */
private static Supplier<Provisioner> createLazyWithRepositories(Consumer<RepositoryHandler> repoConfig) {
    // Running this takes ~3 seconds the first time it is called. Probably because of classloading.
    return Suppliers.memoize(() -> {
        Project project = ProjectBuilder.builder().build();
        repoConfig.accept(project.getRepositories());
        return mavenCoords -> {
            Dependency[] deps = mavenCoords.stream()
                    .map(project.getDependencies()::create)
                    .toArray(Dependency[]::new);
            Configuration config = project.getConfigurations().detachedConfiguration(deps);
            config.setDescription(mavenCoords.toString());
            try {
                return config.resolve();
            } catch (ResolveException e) {
                /* Provide Maven coordinates in exception message instead of static string 'detachedConfiguration' */
                throw new ResolveException(config.getDescription(), e);
            }
        };
    });
}
项目:Reer    文件:DefaultLenientConfiguration.java   
public void rethrowFailure() throws ResolveException {
    if (hasError()) {
        List<Throwable> failures = new ArrayList<Throwable>();
        for (UnresolvedDependency unresolvedDependency : unresolvedDependencies) {
            failures.add(unresolvedDependency.getProblem());
        }
        throw new ResolveException(configuration.toString(), failures);
    }
}
项目:Reer    文件:ShortCircuitEmptyConfigurationResolver.java   
@Override
public void resolveGraph(ConfigurationInternal configuration, ResolverResults results) throws ResolveException {
    if (configuration.getAllDependencies().isEmpty()) {
        emptyGraph(configuration, results);
    } else {
        delegate.resolveGraph(configuration, results);
    }
}
项目:Reer    文件:ShortCircuitEmptyConfigurationResolver.java   
@Override
public void resolveArtifacts(ConfigurationInternal configuration, ResolverResults results) throws ResolveException {
    if (configuration.getAllDependencies().isEmpty()) {
        results.artifactsResolved(new EmptyResolvedConfiguration(), new EmptyResults());
    } else {
        delegate.resolveArtifacts(configuration, results);
    }
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
@Override
public void resolveGraph(ConfigurationInternal configuration, ResolverResults results) throws ResolveException {
    try {
        delegate.resolveGraph(configuration, results);
    } catch (Throwable 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());
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
@Override
public void resolveArtifacts(ConfigurationInternal configuration, ResolverResults results) throws ResolveException {
    try {
        delegate.resolveArtifacts(configuration, results);
    } catch (Throwable e) {
        BrokenResolvedConfiguration broken = new BrokenResolvedConfiguration(e, configuration);
        results.artifactsResolved(broken, broken);
        return;
    }

    ResolvedConfiguration wrappedConfiguration = new ErrorHandlingResolvedConfiguration(results.getResolvedConfiguration(), configuration);
    results.artifactsResolved(wrappedConfiguration, results.getVisitedArtifacts());
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
public void rethrowFailure() throws ResolveException {
    try {
        resolvedConfiguration.rethrowFailure();
    } catch (Throwable e) {
        throw wrapException(e, configuration);
    }
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
@Override
public Set<File> getFiles() throws ResolveException {
    try {
        return resolvedConfiguration.getFiles();
    } catch (ResolveException e) {
        throw wrapException(e, configuration);
    }
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
public Set<File> getFiles(Spec<? super Dependency> dependencySpec) throws ResolveException {
    try {
        return resolvedConfiguration.getFiles(dependencySpec);
    } catch (Throwable e) {
        throw wrapException(e, configuration);
    }
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
public Set<ResolvedDependency> getFirstLevelModuleDependencies() throws ResolveException {
    try {
        return resolvedConfiguration.getFirstLevelModuleDependencies();
    } catch (Throwable e) {
        throw wrapException(e, configuration);
    }
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
public Set<ResolvedDependency> getFirstLevelModuleDependencies(Spec<? super Dependency> dependencySpec) throws ResolveException {
    try {
        return resolvedConfiguration.getFirstLevelModuleDependencies(dependencySpec);
    } catch (Throwable e) {
        throw wrapException(e, configuration);
    }
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
public Set<ResolvedArtifact> getResolvedArtifacts() throws ResolveException {
    try {
        return resolvedConfiguration.getResolvedArtifacts();
    } catch (Throwable e) {
        throw wrapException(e, configuration);
    }
}
项目:Reer    文件:DownloadingScalaToolChain.java   
@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, rootProjectDir, compilerDaemonManager, resolvedScalaClasspath, resolvedZincClasspath);

    } catch(ResolveException resolveException) {
        return new NotFoundScalaToolProvider(resolveException);
    }
}
项目:Reer    文件:DefaultPlayToolChain.java   
@Override
public PlayToolProvider select(PlayPlatform targetPlatform) {
    try {
        Set<File> twirlClasspath = resolveToolClasspath(TwirlCompilerFactory.createAdapter(targetPlatform).getDependencyNotation()).resolve();
        Set<File> routesClasspath = resolveToolClasspath(RoutesCompilerFactory.createAdapter(targetPlatform).getDependencyNotation()).resolve();
        Set<File> javascriptClasspath = resolveToolClasspath(GoogleClosureCompiler.getDependencyNotation()).resolve();
        return new DefaultPlayToolProvider(fileResolver, compilerDaemonManager, workerProcessBuilderFactory, targetPlatform, twirlClasspath, routesClasspath, javascriptClasspath);
    } catch (ResolveException e) {
        return new UnavailablePlayToolProvider(e);
    }
}
项目:Pushjet-Android    文件:CacheLockingArtifactDependencyResolver.java   
public void resolve(final ConfigurationInternal configuration,
                               final List<? extends ResolutionAwareRepository> repositories,
                               final GlobalDependencyResolutionRules metadataHandler,
                               final ResolverResults results) throws ResolveException {
    lockingManager.useCache(String.format("resolve %s", configuration), new Runnable() {
        public void run() {
            resolver.resolve(configuration, repositories, metadataHandler, results);
        }
    });
}
项目:Pushjet-Android    文件:CacheLockingArtifactDependencyResolver.java   
public void resolve(final ConfigurationInternal configuration,
                               final List<? extends ResolutionAwareRepository> repositories,
                               final ModuleMetadataProcessor metadataProcessor,
                               final ResolverResults results) throws ResolveException {
    lockingManager.useCache(String.format("resolve %s", configuration), new Runnable() {
        public void run() {
            resolver.resolve(configuration, repositories, metadataProcessor, results);
        }
    });
}
项目:Reer    文件:ShortCircuitEmptyConfigurationResolver.java   
@Override
public <T extends Collection<? super File>> T collectFiles(T dest) throws ResolveException {
    return dest;
}
项目:Reer    文件:ShortCircuitEmptyConfigurationResolver.java   
@Override
public <T extends Collection<? super ResolvedArtifactResult>> T collectArtifacts(T dest) throws ResolveException {
    return dest;
}
项目:Reer    文件:ShortCircuitEmptyConfigurationResolver.java   
@Override
public void rethrowFailure() throws ResolveException {
}
项目:Reer    文件:ShortCircuitEmptyConfigurationResolver.java   
@Override
public Set<File> getFiles() throws ResolveException {
    return Collections.emptySet();
}
项目:Reer    文件:ShortCircuitEmptyConfigurationResolver.java   
@Override
public Set<ResolvedDependency> getFirstLevelModuleDependencies(Spec<? super Dependency> dependencySpec) throws ResolveException {
    return Collections.emptySet();
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
private static ResolveException wrapException(Throwable e, ResolveContext resolveContext) {
    if (e instanceof ResolveException) {
        return (ResolveException) e;
    }
    return new ResolveException(resolveContext.getDisplayName(), e);
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
@Override
public void rethrowFailure() throws ResolveException {
    throw wrapException(e, configuration);
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
@Override
public Set<File> getFiles() throws ResolveException {
    throw wrapException(e, configuration);
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
@Override
public Set<File> getFiles(Spec<? super Dependency> dependencySpec) throws ResolveException {
    throw wrapException(e, configuration);
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
@Override
public Set<ResolvedDependency> getFirstLevelModuleDependencies() throws ResolveException {
    throw wrapException(e, configuration);
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
@Override
public Set<ResolvedDependency> getFirstLevelModuleDependencies(Spec<? super Dependency> dependencySpec) throws ResolveException {
    throw wrapException(e, configuration);
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
@Override
public Set<ResolvedArtifact> getResolvedArtifacts() throws ResolveException {
    throw wrapException(e, configuration);
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
@Override
public <T extends Collection<? super File>> T collectFiles(T dest) throws ResolveException {
    throw wrapException(e, configuration);
}
项目:Reer    文件:ErrorHandlingConfigurationResolver.java   
@Override
public <T extends Collection<? super ResolvedArtifactResult>> T collectArtifacts(T dest) throws ResolveException {
    throw wrapException(e, configuration);
}
项目:Reer    文件:DefaultResolvedConfiguration.java   
public void rethrowFailure() throws ResolveException {
    configuration.rethrowFailure();
}
项目:Reer    文件:DefaultResolvedConfiguration.java   
@Override
public Set<File> getFiles() throws ResolveException {
    return getFiles(Specs.<Dependency>satisfyAll());
}
项目:Reer    文件:DefaultResolvedConfiguration.java   
public Set<File> getFiles(final Spec<? super Dependency> dependencySpec) throws ResolveException {
    rethrowFailure();
    return configuration.select(dependencySpec, attributes).collectFiles(new LinkedHashSet<File>());
}
项目:Reer    文件:DefaultResolvedConfiguration.java   
public Set<ResolvedDependency> getFirstLevelModuleDependencies() throws ResolveException {
    rethrowFailure();
    return configuration.getFirstLevelModuleDependencies();
}
项目:Reer    文件:DefaultResolvedConfiguration.java   
public Set<ResolvedDependency> getFirstLevelModuleDependencies(Spec<? super Dependency> dependencySpec) throws ResolveException {
    rethrowFailure();
    return configuration.getFirstLevelModuleDependencies(dependencySpec);
}
项目:Reer    文件:DefaultResolvedConfiguration.java   
public Set<ResolvedArtifact> getResolvedArtifacts() throws ResolveException {
    rethrowFailure();
    ArtifactCollectingVisitor visitor = new ArtifactCollectingVisitor();
    configuration.select(Specs.<Dependency>satisfyAll(), attributes).visitArtifacts(visitor);
    return visitor.artifacts;
}
项目:Reer    文件:BuildDependenciesOnlyVisitedArtifactSet.java   
@Override
public <T extends Collection<? super ResolvedArtifactResult>> T collectArtifacts(T dest) throws ResolveException {
    throw new UnsupportedOperationException("Artifacts have not been resolved.");
}
项目:Reer    文件:BuildDependenciesOnlyVisitedArtifactSet.java   
@Override
public <T extends Collection<? super File>> T collectFiles(T dest) throws ResolveException {
    throw new UnsupportedOperationException("Artifacts have not been resolved.");
}