diff --git a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/MavenMetadataVersionResolver.java b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/MavenMetadataVersionResolver.java index b7c23092e6..9a77ab8a58 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/MavenMetadataVersionResolver.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/MavenMetadataVersionResolver.java @@ -58,7 +58,18 @@ final class MavenMetadataVersionResolver implements VersionResolver { MavenMetadataVersionResolver(RestTemplate restTemplate, Collection repositoryUrls) { this.rest = restTemplate; - this.repositoryUrls = repositoryUrls; + this.repositoryUrls = normalize(repositoryUrls); + } + + private Collection normalize(Collection 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 diff --git a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/version/ArtifactVersionDependencyVersion.java b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/version/ArtifactVersionDependencyVersion.java index 296cf41ef3..8a2be48754 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/version/ArtifactVersionDependencyVersion.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/bom/bomr/version/ArtifactVersionDependencyVersion.java @@ -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"); * you may not use this file except in compliance with the License. @@ -75,6 +75,20 @@ class ArtifactVersionDependencyVersion extends AbstractDependencyVersion { && 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 public String toString() { return this.artifactVersion.toString();