Search in sources :

Example 1 with StubVersion

use of org.sonatype.aether.test.util.impl.StubVersion in project sonatype-aether by sonatype.

the class StubVersionRangeResolver method resolveVersionRange.

public VersionRangeResult resolveVersionRange(RepositorySystemSession session, VersionRangeRequest request) throws VersionRangeResolutionException {
    String version = request.getArtifact().getVersion();
    boolean range = false;
    if (version.matches("\\[[^,]+,.*")) {
        version = version.substring(1, version.indexOf(',', 1));
        range = true;
    }
    VersionRangeResult result = new VersionRangeResult(request);
    StubVersion ver = new StubVersion(version);
    result.setVersions(Arrays.asList((Version) ver));
    if (range && !request.getRepositories().isEmpty()) {
        result.setRepository(ver, request.getRepositories().get(0));
    }
    return result;
}
Also used : VersionRangeResult(org.sonatype.aether.resolution.VersionRangeResult) Version(org.sonatype.aether.version.Version) StubVersion(org.sonatype.aether.test.util.impl.StubVersion) StubVersion(org.sonatype.aether.test.util.impl.StubVersion)

Aggregations

VersionRangeResult (org.sonatype.aether.resolution.VersionRangeResult)1 StubVersion (org.sonatype.aether.test.util.impl.StubVersion)1 Version (org.sonatype.aether.version.Version)1