init.gradle
· 2.1 KiB · Groovy
Eredeti
// Modify from https://doc.nju.edu.cn/books/e1654/page/maven
allprojects {
buildscript {
repositories {
def ALIYUN_PUBLIC_URL = 'https://maven.aliyun.com/repository/public/'
def ALIYUN_PLUGIN_URL = 'https://maven.aliyun.com/repository/gradle-plugin/'
all { ArtifactRepository repo ->
if (repo instanceof MavenArtifactRepository) {
def url = repo.url.toString()
if (url.startsWith('https://repo1.maven.org/maven2')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_PUBLIC_URL."
remove repo
}
if (url.startsWith('https://jcenter.bintray.com/') || url.startsWith('https://dl.google.com/dl/android/maven2/') || url.contains('plugins.gradle.org/m2')) {
project.logger.lifecycle "Repository ${repo.url} deleted."
remove repo
}
}
}
maven { url ALIYUN_PUBLIC_URL }
maven { url ALIYUN_PLUGIN_URL }
mavenLocal()
}
}
repositories {
def ALIYUN_PUBLIC_URL = 'https://maven.aliyun.com/repository/public/'
def ALIYUN_PLUGIN_URL = 'https://maven.aliyun.com/repository/gradle-plugin/'
all { ArtifactRepository repo ->
if (repo instanceof MavenArtifactRepository) {
def url = repo.url.toString()
if (url.startsWith('https://repo1.maven.org/maven2')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_PUBLIC_URL."
remove repo
}
if (url.startsWith('https://jcenter.bintray.com/') || url.startsWith('https://dl.google.com/dl/android/maven2/') || url.contains('plugins.gradle.org/m2')) {
project.logger.lifecycle "Repository ${repo.url} deleted."
remove repo
}
}
}
maven { url ALIYUN_PUBLIC_URL }
maven { url ALIYUN_PLUGIN_URL }
mavenLocal()
}
}
| 1 | // Modify from https://doc.nju.edu.cn/books/e1654/page/maven |
| 2 | |
| 3 | allprojects { |
| 4 | buildscript { |
| 5 | repositories { |
| 6 | def ALIYUN_PUBLIC_URL = 'https://maven.aliyun.com/repository/public/' |
| 7 | def ALIYUN_PLUGIN_URL = 'https://maven.aliyun.com/repository/gradle-plugin/' |
| 8 | all { ArtifactRepository repo -> |
| 9 | if (repo instanceof MavenArtifactRepository) { |
| 10 | def url = repo.url.toString() |
| 11 | if (url.startsWith('https://repo1.maven.org/maven2')) { |
| 12 | project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_PUBLIC_URL." |
| 13 | remove repo |
| 14 | } |
| 15 | if (url.startsWith('https://jcenter.bintray.com/') || url.startsWith('https://dl.google.com/dl/android/maven2/') || url.contains('plugins.gradle.org/m2')) { |
| 16 | project.logger.lifecycle "Repository ${repo.url} deleted." |
| 17 | remove repo |
| 18 | } |
| 19 | } |
| 20 | } |
| 21 | maven { url ALIYUN_PUBLIC_URL } |
| 22 | maven { url ALIYUN_PLUGIN_URL } |
| 23 | mavenLocal() |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | repositories { |
| 28 | def ALIYUN_PUBLIC_URL = 'https://maven.aliyun.com/repository/public/' |
| 29 | def ALIYUN_PLUGIN_URL = 'https://maven.aliyun.com/repository/gradle-plugin/' |
| 30 | all { ArtifactRepository repo -> |
| 31 | if (repo instanceof MavenArtifactRepository) { |
| 32 | def url = repo.url.toString() |
| 33 | if (url.startsWith('https://repo1.maven.org/maven2')) { |
| 34 | project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_PUBLIC_URL." |
| 35 | remove repo |
| 36 | } |
| 37 | if (url.startsWith('https://jcenter.bintray.com/') || url.startsWith('https://dl.google.com/dl/android/maven2/') || url.contains('plugins.gradle.org/m2')) { |
| 38 | project.logger.lifecycle "Repository ${repo.url} deleted." |
| 39 | remove repo |
| 40 | } |
| 41 | } |
| 42 | } |
| 43 | maven { url ALIYUN_PUBLIC_URL } |
| 44 | maven { url ALIYUN_PLUGIN_URL } |
| 45 | mavenLocal() |
| 46 | } |
| 47 | } |
| 48 |