Search in sources :

Example 1 with MavenMetadata

use of org.gradle.api.internal.artifacts.repositories.maven.MavenMetadata in project gradle by gradle.

the class MavenResolver method findUniqueSnapshotVersion.

@Nullable
private MavenUniqueSnapshotModuleSource findUniqueSnapshotVersion(ModuleComponentIdentifier module, ResourceAwareResolveResult result) {
    M2ResourcePattern wholePattern = getWholePattern();
    if (!wholePattern.isComplete(module)) {
        // do not attempt to download maven-metadata.xml for incomplete identifiers
        return null;
    }
    ExternalResourceName metadataLocation = wholePattern.toModuleVersionPath(module).resolve("maven-metadata.xml");
    result.attempted(metadataLocation);
    MavenMetadata mavenMetadata = parseMavenMetadata(metadataLocation);
    if (mavenMetadata.timestamp != null) {
        // we have found a timestamp, so this is a snapshot unique version
        String timestamp = mavenMetadata.timestamp + "-" + mavenMetadata.buildNumber;
        return new MavenUniqueSnapshotModuleSource(timestamp);
    }
    return null;
}
Also used : ExternalResourceName(org.gradle.internal.resource.ExternalResourceName) MavenMetadata(org.gradle.api.internal.artifacts.repositories.maven.MavenMetadata) Nullable(javax.annotation.Nullable)

Aggregations

Nullable (javax.annotation.Nullable)1 MavenMetadata (org.gradle.api.internal.artifacts.repositories.maven.MavenMetadata)1 ExternalResourceName (org.gradle.internal.resource.ExternalResourceName)1