Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ plugins {

allprojects {
repositories {
mavenCentral()
def mavenCentralMirror = System.getProperty('mavenCentralMirror')
if (mavenCentralMirror) {
maven { url = mavenCentralMirror }
} else {
mavenCentral()
}
}
}

Expand Down
7 changes: 6 additions & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ plugins {
}

repositories {
def mavenCentralMirror = System.getProperty('mavenCentralMirror')
if (mavenCentralMirror) {
maven { url = mavenCentralMirror }
} else {
mavenCentral()
}
gradlePluginPortal()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question) Just to be sure, the target is only mavenCentral and not other repositories - is my understanding correct?

mavenCentral()
}

dependencies {
Expand Down
14 changes: 12 additions & 2 deletions gradle/scripts/lib/common-dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import org.yaml.snakeyaml.Yaml

buildscript {
repositories {
mavenCentral()
def mavenCentralMirror = System.getProperty('mavenCentralMirror')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: This is unfortunate, we should move on to using conventions plugins instead so that we don't have to redeclare this for every buildscript closure

if (mavenCentralMirror) {
maven { url = mavenCentralMirror }
} else {
mavenCentral()
}
gradlePluginPortal()
}

Expand Down Expand Up @@ -36,7 +41,12 @@ configure(dependencyManagementProject) {
google()
// Since we manage plugin versions here too.
gradlePluginPortal()
mavenCentral()
def mavenCentralMirror = System.getProperty('mavenCentralMirror')
if (mavenCentralMirror) {
maven { url = mavenCentralMirror }
} else {
mavenCentral()
}
}

javaPlatform {
Expand Down
4 changes: 4 additions & 0 deletions gradle/scripts/lib/java-rpc-proto.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import org.gradle.internal.os.OperatingSystem

buildscript {
repositories {
def mavenCentralMirror = System.getProperty('mavenCentralMirror')
if (mavenCentralMirror) {
maven { url = mavenCentralMirror }
}
gradlePluginPortal()
}
dependencies {
Expand Down
4 changes: 4 additions & 0 deletions gradle/scripts/lib/java-shade.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import java.util.concurrent.atomic.AtomicInteger

buildscript {
repositories {
def mavenCentralMirror = System.getProperty('mavenCentralMirror')
if (mavenCentralMirror) {
maven { url = mavenCentralMirror }
}
gradlePluginPortal()
google()
}
Expand Down
7 changes: 6 additions & 1 deletion gradle/scripts/version-catalog.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import org.tomlj.TomlArray

buildscript {
repositories {
mavenCentral()
def mavenCentralMirror = System.getProperty('mavenCentralMirror')
if (mavenCentralMirror) {
maven { url = mavenCentralMirror }
} else {
mavenCentral()
}
}

dependencies {
Expand Down
12 changes: 12 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
// Use -DmavenCentralMirror=<url> or systemProp.mavenCentralMirror=<url> in
// ~/.gradle/gradle.properties to redirect all Maven Central requests to a mirror.
pluginManagement {
repositories {
def mavenCentralMirror = System.getProperty('mavenCentralMirror')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question) Is it possible to use gradle properties (providers.gradleProperty or project.findProperty) instead of system properties? (in case we want finer control over overwriting per project, etc. in the future)

if (mavenCentralMirror) {
maven { url = mavenCentralMirror }
}
gradlePluginPortal()
}
}

plugins {
// This plugin should be applied in settings.gradle, not build.gradle.
// https://github.com/gradle/foojay-toolchains/issues/15
Expand Down
7 changes: 6 additions & 1 deletion site-new/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ import java.util.stream.Collectors

buildscript {
repositories {
def mavenCentralMirror = System.getProperty('mavenCentralMirror')
if (mavenCentralMirror) {
maven { url = mavenCentralMirror }
} else {
mavenCentral()
}
gradlePluginPortal()
mavenCentral()
}
dependencies {
classpath libs.jsoup
Expand Down
Loading