zyppe ha revisionato questo gist 2 months ago. Vai alla revisione
1 file changed, 1 insertion, 1 deletion
init.gradle
| @@ -19,7 +19,7 @@ allprojects { | |||
| 19 | 19 | } | |
| 20 | 20 | } | |
| 21 | 21 | maven { url ALIYUN_PUBLIC_URL } | |
| 22 | - | maven { url ALIYUN_PLUGIN_URL} | |
| 22 | + | maven { url ALIYUN_PLUGIN_URL } | |
| 23 | 23 | mavenLocal() | |
| 24 | 24 | } | |
| 25 | 25 | } | |
zyppe ha revisionato questo gist 2 months ago. Vai alla revisione
1 file changed, 14 insertions, 24 deletions
init.gradle
| @@ -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 | } | |
zyppe ha revisionato questo gist 1 year ago. Vai alla revisione
1 file changed, 57 insertions
init.gradle(file creato)
| @@ -0,0 +1,57 @@ | |||
| 1 | + | allprojects { | |
| 2 | + | buildscript { | |
| 3 | + | repositories { | |
| 4 | + | def ALIYUN_REPOSITORY_URL = 'https://maven.aliyun.com/repository/public/' | |
| 5 | + | all { ArtifactRepository repo -> | |
| 6 | + | if (repo instanceof MavenArtifactRepository) { | |
| 7 | + | def url = repo.url.toString() | |
| 8 | + | 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." | |
| 18 | + | remove repo | |
| 19 | + | } | |
| 20 | + | if (url.contains('plugins.gradle.org/m2')) { | |
| 21 | + | project.logger.lifecycle "Repository ${repo.url} deleted." | |
| 22 | + | remove repo | |
| 23 | + | } | |
| 24 | + | } | |
| 25 | + | } | |
| 26 | + | maven { url ALIYUN_REPOSITORY_URL } | |
| 27 | + | mavenLocal() | |
| 28 | + | } | |
| 29 | + | } | |
| 30 | + | ||
| 31 | + | repositories { | |
| 32 | + | def ALIYUN_REPOSITORY_URL = 'https://maven.aliyun.com/repository/public/' | |
| 33 | + | all { ArtifactRepository repo -> | |
| 34 | + | if (repo instanceof MavenArtifactRepository) { | |
| 35 | + | def url = repo.url.toString() | |
| 36 | + | 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." | |
| 46 | + | remove repo | |
| 47 | + | } | |
| 48 | + | if (url.contains('plugins.gradle.org/m2')) { | |
| 49 | + | project.logger.lifecycle "Repository ${repo.url} deleted." | |
| 50 | + | remove repo | |
| 51 | + | } | |
| 52 | + | } | |
| 53 | + | } | |
| 54 | + | maven { url ALIYUN_REPOSITORY_URL } | |
| 55 | + | mavenLocal() | |
| 56 | + | } | |
| 57 | + | } | |