-
Notifications
You must be signed in to change notification settings - Fork 989
Allow configuring a Maven Central mirror via system property #6712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,7 +4,12 @@ import org.yaml.snakeyaml.Yaml | |
|
|
||
| buildscript { | ||
| repositories { | ||
| mavenCentral() | ||
| def mavenCentralMirror = System.getProperty('mavenCentralMirror') | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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() | ||
| } | ||
|
|
||
|
|
@@ -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 { | ||
|
|
||
| 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') | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question) Is it possible to use gradle properties ( |
||
| 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 | ||
|
|
||
There was a problem hiding this comment.
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
mavenCentraland not other repositories - is my understanding correct?