Search in sources :

Example 1 with ResourcePattern

use of org.gradle.api.internal.artifacts.repositories.resolver.ResourcePattern 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);
    }
}
Also used : ExternalResourceName(org.gradle.internal.resource.ExternalResourceName) ResourcePattern(org.gradle.api.internal.artifacts.repositories.resolver.ResourcePattern) MissingResourceException(org.gradle.api.resources.MissingResourceException)

Aggregations

ResourcePattern (org.gradle.api.internal.artifacts.repositories.resolver.ResourcePattern)1 MissingResourceException (org.gradle.api.resources.MissingResourceException)1 ExternalResourceName (org.gradle.internal.resource.ExternalResourceName)1