use of org.gradle.api.resources.MissingResourceException in project gradle by gradle.
the class MavenMetadataLoader method parseMavenMetadataInfo.
private void parseMavenMetadataInfo(final ExternalResourceName metadataLocation, final MavenMetadata metadata) throws IOException {
ExternalResource resource = cacheAwareExternalResourceAccessor.getResource(metadataLocation, null, new CacheAwareExternalResourceAccessor.ResourceFileStore() {
@Override
public LocallyAvailableResource moveIntoCache(File downloadedResource) {
String key = metadataLocation.toString();
return resourcesFileStore.move(key, downloadedResource);
}
}, null);
if (resource == null) {
throw new MissingResourceException(metadataLocation.getUri(), String.format("Maven meta-data not available at %s", metadataLocation));
}
parseMavenMetadataInto(resource, metadata);
}
use of org.gradle.api.resources.MissingResourceException in project gradle by gradle.
the class MavenVersionLister method listVersions.
public void listVersions(ModuleIdentifier module, List<ResourcePattern> patterns, BuildableModuleVersionListingResolveResult result) {
final Set<ExternalResourceName> searched = Sets.newHashSet();
List<String> versions = Lists.newArrayList();
boolean hasResult = false;
for (ResourcePattern pattern : patterns) {
ExternalResourceName metadataLocation = pattern.toModulePath(module).resolve("maven-metadata.xml");
if (searched.add(metadataLocation)) {
result.attempted(metadataLocation);
try {
MavenMetadata mavenMetaData = mavenMetadataLoader.load(metadataLocation);
versions.addAll(mavenMetaData.versions);
hasResult = true;
} catch (MissingResourceException e) {
// Continue
}
}
}
if (hasResult) {
result.listed(versions);
}
}
use of org.gradle.api.resources.MissingResourceException in project gradle by gradle.
the class BuildLayoutFactory method getLayoutFor.
/**
* Determines the layout of the build, given a current directory and some other configuration.
*/
public BuildLayout getLayoutFor(BuildLayoutConfiguration configuration) {
if (configuration.isUseEmptySettings()) {
return buildLayoutFrom(configuration, null);
}
File explicitSettingsFile = configuration.getSettingsFile();
if (explicitSettingsFile != null) {
if (!explicitSettingsFile.isFile()) {
throw new MissingResourceException(explicitSettingsFile.toURI(), String.format("Could not read settings file '%s' as it does not exist.", explicitSettingsFile.getAbsolutePath()));
}
return buildLayoutFrom(configuration, explicitSettingsFile);
}
File currentDir = configuration.getCurrentDir();
boolean searchUpwards = configuration.isSearchUpwards();
return getLayoutFor(currentDir, searchUpwards ? null : currentDir.getParentFile());
}
Aggregations