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