Stop using repo.spring.io/milestone

As of this new major, all milestones should be shipped to central as
well. This commit removes the inclusion of the milestone repository as
this shouldn't be needed anymore.

Closes gh-46420
This commit is contained in:
Stéphane Nicoll
2025-07-14 15:57:47 +02:00
parent 5620be0d9c
commit 17ee49be2e
5 changed files with 29 additions and 43 deletions
-3
View File
@@ -101,9 +101,6 @@ class SpringRepositoriesExtension {
private void addRepositories(action) {
addCommercialRepository("release", false, "/spring-enterprise-maven-prod-local", action)
if (this.version.contains("-")) {
addOssRepository("milestone", false, "/milestone", action)
}
if (this.version.endsWith("-SNAPSHOT")) {
addCommercialRepository("snapshot", true, "/spring-enterprise-maven-dev-local", action)
addOssRepository("snapshot", true, "/snapshot", action)
@@ -28,7 +28,7 @@ import org.gradle.api.Project;
*/
public final class ArtifactRelease {
private static final String SPRING_REPO = "https://repo.spring.io/%s";
private static final String SPRING_SNAPSHOT_REPO = "https://repo.spring.io/snapshot";
private static final String MAVEN_REPO = "https://repo.maven.apache.org/maven2";
@@ -43,7 +43,7 @@ public final class ArtifactRelease {
}
public String getDownloadRepo() {
return (this.isRelease()) ? MAVEN_REPO : String.format(SPRING_REPO, this.getType());
return (this.type == Type.SNAPSHOT) ? SPRING_SNAPSHOT_REPO : MAVEN_REPO;
}
public boolean isRelease() {
@@ -134,7 +134,7 @@ class AntoraAsciidocAttributesTests {
void urlArtifactRepositoryWhenMilestone() {
AntoraAsciidocAttributes attributes = new AntoraAsciidocAttributes("1.2.3-M1", true, BuildType.OPEN_SOURCE,
null, mockDependencyVersions(), null);
assertThat(attributes.get()).containsEntry("url-artifact-repository", "https://repo.spring.io/milestone");
assertThat(attributes.get()).containsEntry("url-artifact-repository", "https://repo.maven.apache.org/maven2");
}
@Test
@@ -66,17 +66,19 @@ class ArtifactReleaseTests {
}
@Test
void whenProjectVersionIsMilestoneThenRepositoryIsArtifactoryMilestone() {
void whenProjectVersionIsMilestoneThenRepositoryIsMavenCentral() {
Project project = ProjectBuilder.builder().build();
project.setVersion("1.2.3-M1");
assertThat(ArtifactRelease.forProject(project).getDownloadRepo()).contains("repo.spring.io/milestone");
project.setVersion("4.0.0-M1");
assertThat(ArtifactRelease.forProject(project).getDownloadRepo())
.contains("https://repo.maven.apache.org/maven2");
}
@Test
void whenProjectVersionIsReleaseCandidateThenRepositoryIsArtifactoryMilestone() {
void whenProjectVersionIsReleaseCandidateThenRepositoryIsMavenCentral() {
Project project = ProjectBuilder.builder().build();
project.setVersion("1.2.3-RC1");
assertThat(ArtifactRelease.forProject(project).getDownloadRepo()).contains("repo.spring.io/milestone");
project.setVersion("4.0.0-RC1");
assertThat(ArtifactRelease.forProject(project).getDownloadRepo())
.contains("https://repo.maven.apache.org/maven2");
}
@Test
@@ -80,57 +80,45 @@ class SpringRepositoriesExtensionTests {
void mavenRepositoriesWhenNotCommercialSnapshot() {
SpringRepositoriesExtension extension = createExtension("0.0.0-SNAPSHOT", "oss");
extension.mavenRepositories();
assertThat(this.repositories).hasSize(2);
verify(this.repositories.get(0)).setName("spring-oss-milestone");
verify(this.repositories.get(0)).setUrl("https://repo.spring.io/milestone");
verify(this.mavenContent.get(0)).releasesOnly();
verify(this.repositories.get(1)).setName("spring-oss-snapshot");
verify(this.repositories.get(1)).setUrl("https://repo.spring.io/snapshot");
verify(this.mavenContent.get(1)).snapshotsOnly();
assertThat(this.repositories).hasSize(1);
verify(this.repositories.get(0)).setName("spring-oss-snapshot");
verify(this.repositories.get(0)).setUrl("https://repo.spring.io/snapshot");
verify(this.mavenContent.get(0)).snapshotsOnly();
}
@Test
void mavenRepositoriesWhenCommercialSnapshot() {
SpringRepositoriesExtension extension = createExtension("0.0.0-SNAPSHOT", "commercial");
extension.mavenRepositories();
assertThat(this.repositories).hasSize(4);
assertThat(this.repositories).hasSize(3);
verify(this.repositories.get(0)).setName("spring-commercial-release");
verify(this.repositories.get(0))
.setUrl("https://usw1.packages.broadcom.com/spring-enterprise-maven-prod-local");
verify(this.mavenContent.get(0)).releasesOnly();
verify(this.repositories.get(1)).setName("spring-oss-milestone");
verify(this.repositories.get(1)).setUrl("https://repo.spring.io/milestone");
verify(this.mavenContent.get(1)).releasesOnly();
verify(this.repositories.get(2)).setName("spring-commercial-snapshot");
verify(this.repositories.get(2)).setUrl("https://usw1.packages.broadcom.com/spring-enterprise-maven-dev-local");
verify(this.repositories.get(1)).setName("spring-commercial-snapshot");
verify(this.repositories.get(1)).setUrl("https://usw1.packages.broadcom.com/spring-enterprise-maven-dev-local");
verify(this.mavenContent.get(1)).snapshotsOnly();
verify(this.repositories.get(2)).setName("spring-oss-snapshot");
verify(this.repositories.get(2)).setUrl("https://repo.spring.io/snapshot");
verify(this.mavenContent.get(2)).snapshotsOnly();
verify(this.repositories.get(3)).setName("spring-oss-snapshot");
verify(this.repositories.get(3)).setUrl("https://repo.spring.io/snapshot");
verify(this.mavenContent.get(3)).snapshotsOnly();
}
@Test
void mavenRepositoriesWhenNotCommercialMilestone() {
SpringRepositoriesExtension extension = createExtension("0.0.0-M1", "oss");
extension.mavenRepositories();
assertThat(this.repositories).hasSize(1);
verify(this.repositories.get(0)).setName("spring-oss-milestone");
verify(this.repositories.get(0)).setUrl("https://repo.spring.io/milestone");
verify(this.mavenContent.get(0)).releasesOnly();
assertThat(this.repositories).isEmpty();
}
@Test
void mavenRepositoriesWhenCommercialMilestone() {
SpringRepositoriesExtension extension = createExtension("0.0.0-M1", "commercial");
extension.mavenRepositories();
assertThat(this.repositories).hasSize(2);
assertThat(this.repositories).hasSize(1);
verify(this.repositories.get(0)).setName("spring-commercial-release");
verify(this.repositories.get(0))
.setUrl("https://usw1.packages.broadcom.com/spring-enterprise-maven-prod-local");
verify(this.mavenContent.get(0)).releasesOnly();
verify(this.repositories.get(1)).setName("spring-oss-milestone");
verify(this.repositories.get(1)).setUrl("https://repo.spring.io/milestone");
verify(this.mavenContent.get(1)).releasesOnly();
}
@Test
@@ -155,7 +143,7 @@ class SpringRepositoriesExtensionTests {
void mavenRepositoriesWhenConditionMatches() {
SpringRepositoriesExtension extension = createExtension("0.0.0-SNAPSHOT", "oss");
extension.mavenRepositories(true);
assertThat(this.repositories).hasSize(2);
assertThat(this.repositories).hasSize(1);
}
@Test
@@ -169,9 +157,8 @@ class SpringRepositoriesExtensionTests {
void mavenRepositoriesExcludingBootGroup() {
SpringRepositoriesExtension extension = createExtension("0.0.0-SNAPSHOT", "oss");
extension.mavenRepositoriesExcludingBootGroup();
assertThat(this.contents).hasSize(2);
assertThat(this.contents).hasSize(1);
verify(this.contents.get(0)).excludeGroup("org.springframework.boot");
verify(this.contents.get(1)).excludeGroup("org.springframework.boot");
}
@Test
@@ -185,9 +172,9 @@ class SpringRepositoriesExtensionTests {
environment.put("COMMERCIAL_SNAPSHOT_REPO_PASSWORD", "spass");
SpringRepositoriesExtension extension = createExtension("0.0.0-SNAPSHOT", "commercial", environment::get);
extension.mavenRepositories();
assertThat(this.repositories).hasSize(4);
assertThat(this.repositories).hasSize(3);
verify(this.repositories.get(0)).setUrl("curl");
verify(this.repositories.get(2)).setUrl("surl");
verify(this.repositories.get(1)).setUrl("surl");
assertThat(this.credentials).hasSize(2);
verify(this.credentials.get(0)).setUsername("cuser");
verify(this.credentials.get(0)).setPassword("cpass");
@@ -203,9 +190,9 @@ class SpringRepositoriesExtensionTests {
environment.put("COMMERCIAL_REPO_PASSWORD", "pass");
SpringRepositoriesExtension extension = createExtension("0.0.0-SNAPSHOT", "commercial", environment::get);
extension.mavenRepositories();
assertThat(this.repositories).hasSize(4);
assertThat(this.repositories).hasSize(3);
verify(this.repositories.get(0)).setUrl("url");
verify(this.repositories.get(2)).setUrl("url");
verify(this.repositories.get(1)).setUrl("url");
assertThat(this.credentials).hasSize(2);
verify(this.credentials.get(0)).setUsername("user");
verify(this.credentials.get(0)).setPassword("pass");