Skip to content

Commit ae52ab4

Browse files
committed
Add CI mirror and JDK group excludes to avoid Maven Central throttling
Manually cherry-picked the changes from e3400ac. Signed-off-by: Andrew Ross <andrross@amazon.com>
1 parent 3c38b5e commit ae52ab4

11 files changed

Lines changed: 59 additions & 7 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ tasks.register("verifyVersions") {
168168
// Fetch the metadata and parse the xml into Version instances because it's more straight forward here
169169
// rather than bwcVersion ( VersionCollection ).
170170
//TODO OpenSearch - Update the maven repo URL for OpenSearch when available.
171-
new URL('https://repo1.maven.org/maven2/org/elasticsearch/elasticsearch/maven-metadata.xml').openStream().withStream { s ->
171+
new URL('https://ci.opensearch.org/maven2/org/elasticsearch/elasticsearch/maven-metadata.xml').openStream().withStream { s ->
172172
BuildParams.bwcVersions.compareToAuthoritative(
173173
new XmlParser().parse(s)
174174
.versioning.versions.version

buildSrc/build.gradle

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,22 @@ tasks.withType(JavaCompile).configureEach {
9494
*****************************************************************************/
9595

9696
repositories {
97-
mavenCentral()
98-
gradlePluginPortal()
97+
maven {
98+
url = uri("https://ci.opensearch.org/maven2/")
99+
content {
100+
excludeGroupByRegex "adoptium.*|adoptopenjdk.*|openjdk.*"
101+
}
102+
}
103+
mavenCentral {
104+
content {
105+
excludeGroupByRegex "adoptium.*|adoptopenjdk.*|openjdk.*"
106+
}
107+
}
108+
gradlePluginPortal {
109+
content {
110+
excludeGroupByRegex "adoptium.*|adoptopenjdk.*|openjdk.*"
111+
}
112+
}
99113
}
100114

101115
dependencies {

buildSrc/src/integTest/groovy/org/opensearch/gradle/OpenSearchTestBasePluginFuncTest.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class OpenSearchTestBasePluginFuncTest extends AbstractGradleFuncTest {
5353
}
5454
5555
repositories {
56+
maven { url = uri("https://ci.opensearch.org/maven2/") }
5657
mavenCentral()
5758
}
5859

buildSrc/src/main/java/org/opensearch/gradle/RepositoriesSetupPlugin.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,12 @@ public static void configureRepositories(Project project) {
8282
// such that we don't have to pass hardcoded files to gradle
8383
repos.mavenLocal();
8484
}
85-
repos.mavenCentral();
85+
repos.maven(repo -> {
86+
repo.setName("Maven Cache");
87+
repo.setUrl("https://ci.opensearch.org/maven2/");
88+
repo.content(descriptor -> descriptor.excludeGroupByRegex("adoptium.*|adoptopenjdk.*|openjdk.*"));
89+
});
90+
repos.mavenCentral(repo -> { repo.content(descriptor -> descriptor.excludeGroupByRegex("adoptium.*|adoptopenjdk.*|openjdk.*")); });
8691

8792
String luceneVersion = VersionProperties.getLucene();
8893
if (luceneVersion.contains("-snapshot")) {

buildSrc/src/testKit/opensearch.build/build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ repositories {
3939
artifact()
4040
}
4141
}
42+
maven { url = uri("https://ci.opensearch.org/maven2/") }
4243
mavenCentral()
4344
}
4445

@@ -53,6 +54,7 @@ repositories {
5354
artifact()
5455
}
5556
}
57+
maven { url = uri("https://ci.opensearch.org/maven2/") }
5658
mavenCentral()
5759
}
5860

buildSrc/src/testKit/testingConventions/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ allprojects {
1818
apply plugin: 'opensearch.build'
1919

2020
repositories {
21+
maven { url = uri("https://ci.opensearch.org/maven2/") }
2122
mavenCentral()
2223
}
2324
dependencies {

buildSrc/src/testKit/thirdPartyAudit/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ repositories {
3636
artifact()
3737
}
3838
}
39+
maven { url = uri("https://ci.opensearch.org/maven2/") }
3940
mavenCentral()
4041
}
4142

buildSrc/src/testKit/thirdPartyAudit/sample_jars/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ plugins {
1313
id 'java'
1414
}
1515
repositories {
16+
maven { url = uri("https://ci.opensearch.org/maven2/") }
1617
mavenCentral()
1718
}
1819
dependencies {

gradle/code-coverage.gradle

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,17 @@
99
apply plugin: 'jacoco'
1010

1111
repositories {
12-
mavenCentral()
12+
maven {
13+
url = "https://ci.opensearch.org/maven2/"
14+
content {
15+
excludeGroupByRegex "adoptium.*|adoptopenjdk.*|openjdk.*"
16+
}
17+
}
18+
mavenCentral {
19+
content {
20+
excludeGroupByRegex "adoptium.*|adoptopenjdk.*|openjdk.*"
21+
}
22+
}
1323
}
1424

1525
allprojects {

gradle/ide.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ import org.jetbrains.gradle.ext.JUnit
1515

1616
buildscript {
1717
repositories {
18+
maven {
19+
url = "https://ci.opensearch.org/maven2/"
20+
}
1821
maven {
1922
url "https://plugins.gradle.org/m2/"
2023
}

0 commit comments

Comments
 (0)