Improve Bomr's upgrade suggestions for milestones and RCs

Closes gh-34307
pull/34729/head
Andy Wilkinson 2 years ago
parent add78d4e8d
commit a401ff87d0

@ -58,7 +58,18 @@ final class MavenMetadataVersionResolver implements VersionResolver {
MavenMetadataVersionResolver(RestTemplate restTemplate, Collection<URI> repositoryUrls) { MavenMetadataVersionResolver(RestTemplate restTemplate, Collection<URI> repositoryUrls) {
this.rest = restTemplate; this.rest = restTemplate;
this.repositoryUrls = repositoryUrls; this.repositoryUrls = normalize(repositoryUrls);
}
private Collection<URI> normalize(Collection<URI> uris) {
return uris.stream().map(this::normalize).toList();
}
private URI normalize(URI uri) {
if ("/".equals(uri.getPath())) {
return uri;
}
return URI.create(uri.toString() + "/");
} }
@Override @Override

@ -1,5 +1,5 @@
/* /*
* Copyright 2012-2022 the original author or authors. * Copyright 2012-2023 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -75,6 +75,20 @@ class ArtifactVersionDependencyVersion extends AbstractDependencyVersion {
&& isNewerThan(other); && isNewerThan(other);
} }
@Override
public int compareTo(DependencyVersion other) {
if (other instanceof ArtifactVersionDependencyVersion otherArtifactDependencyVersion) {
ArtifactVersion otherArtifactVersion = otherArtifactDependencyVersion.artifactVersion;
if ("snapshot".equalsIgnoreCase(otherArtifactVersion.getQualifier())
&& otherArtifactVersion.getMajorVersion() == this.artifactVersion.getMajorVersion()
&& otherArtifactVersion.getMinorVersion() == this.artifactVersion.getMinorVersion()
&& otherArtifactVersion.getIncrementalVersion() == this.artifactVersion.getIncrementalVersion()) {
return 1;
}
}
return super.compareTo(other);
}
@Override @Override
public String toString() { public String toString() {
return this.artifactVersion.toString(); return this.artifactVersion.toString();

Loading…
Cancel
Save