use of org.gradle.internal.resolve.ModuleVersionNotFoundException in project gradle by gradle.
the class DynamicVersionResolver method notFound.
private void notFound(BuildableComponentIdResolveResult result, ModuleComponentSelector requested, List<RepositoryResolveState> resolveStates) {
Set<String> unmatchedVersions = new LinkedHashSet<String>();
Set<String> rejectedVersions = new LinkedHashSet<String>();
for (RepositoryResolveState resolveState : resolveStates) {
resolveState.applyTo(result, unmatchedVersions, rejectedVersions);
}
result.failed(new ModuleVersionNotFoundException(requested, result.getAttempted(), unmatchedVersions, rejectedVersions));
}
use of org.gradle.internal.resolve.ModuleVersionNotFoundException in project gradle by gradle.
the class DynamicVersionResolver method notFound.
private void notFound(BuildableComponentIdResolveResult result, ModuleVersionSelector requested, List<RepositoryResolveState> resolveStates) {
Set<String> unmatchedVersions = new LinkedHashSet<String>();
Set<String> rejectedVersions = new LinkedHashSet<String>();
for (RepositoryResolveState resolveState : resolveStates) {
resolveState.applyTo(result, unmatchedVersions, rejectedVersions);
}
result.failed(new ModuleVersionNotFoundException(requested, result.getAttempted(), unmatchedVersions, rejectedVersions));
}
use of org.gradle.internal.resolve.ModuleVersionNotFoundException in project gradle by gradle.
the class VcsDependencyResolver method resolve.
@Override
public void resolve(DependencyMetadata dependency, ResolvedVersionConstraint versionConstraint, BuildableComponentIdResolveResult result) {
if (dependency.getSelector() instanceof ModuleComponentSelector) {
final ModuleComponentSelector depSelector = (ModuleComponentSelector) dependency.getSelector();
VersionControlSpec spec = vcsResolver.locateVcsFor(depSelector);
// TODO: Need failure handling, e.g., cannot clone repository
if (spec != null) {
VersionControlSystem versionControlSystem = versionControlSystemFactory.create(spec);
VersionRef selectedVersion = selectVersion(depSelector, spec, versionControlSystem);
if (selectedVersion == null) {
result.failed(new ModuleVersionNotFoundException(depSelector, Collections.singleton(spec.getDisplayName())));
return;
}
File dependencyWorkingDir = new File(populateWorkingDirectory(baseWorkingDir, spec, versionControlSystem, selectedVersion), spec.getRootDir());
// TODO: This shouldn't rely on the service registry to find NestedBuildFactory
IncludedBuildRegistry includedBuildRegistry = serviceRegistry.get(IncludedBuildRegistry.class);
NestedBuildFactory nestedBuildFactory = serviceRegistry.get(NestedBuildFactory.class);
IncludedBuildInternal includedBuild = includedBuildRegistry.addImplicitBuild(((AbstractVersionControlSpec) spec).getBuildDefinition(dependencyWorkingDir), nestedBuildFactory);
Collection<Pair<ModuleVersionIdentifier, ProjectComponentIdentifier>> moduleToProject = includedBuild.getAvailableModules();
Pair<ModuleVersionIdentifier, ProjectComponentIdentifier> entry = CollectionUtils.findFirst(moduleToProject, new Spec<Pair<ModuleVersionIdentifier, ProjectComponentIdentifier>>() {
@Override
public boolean isSatisfiedBy(Pair<ModuleVersionIdentifier, ProjectComponentIdentifier> entry) {
ModuleVersionIdentifier possibleMatch = entry.left;
return depSelector.getGroup().equals(possibleMatch.getGroup()) && depSelector.getModule().equals(possibleMatch.getName());
}
});
if (entry == null) {
result.failed(new ModuleVersionResolveException(depSelector, spec.getDisplayName() + " did not contain a project publishing the specified dependency."));
} else {
LocalComponentMetadata componentMetaData = localComponentRegistry.getComponent(entry.right);
if (componentMetaData == null) {
result.failed(new ModuleVersionResolveException(DefaultProjectComponentSelector.newSelector(includedBuild.getModel(), entry.right.getProjectPath()), spec.getDisplayName() + " could not be resolved into a usable project."));
} else {
result.resolved(componentMetaData);
}
return;
}
}
}
projectDependencyResolver.resolve(dependency, versionConstraint, result);
}
Aggregations