赞
踩
- fun RepositoryHandler.enableMirror() {
- all {
- if (this is MavenArtifactRepository) {
- val originalUrl = this.url.toString().removeSuffix("/")
- urlMappings[originalUrl]?.let {
- logger.lifecycle("Repository[$url] is mirrored to $it")
- this.setUrl(it)
- }
- }
- }
- }
-
- val urlMappings = mapOf(
- "https://repo.maven.apache.org/maven2" to "https://mirrors.tencent.com/nexus/repository/maven-public/",
- "https://dl.google.com/dl/android/maven2" to "https://mirrors.tencent.com/nexus/repository/maven-public/",
- "https://plugins.gradle.org/m2" to "https://mirrors.tencent.com/nexus/repository/gradle-plugins/"
- )
-
- gradle.allprojects {
- buildscript {
- repositories.enableMirror()
- }
- repositories.enableMirror()
- }
-
- gradle.beforeSettings {
- pluginManagement.repositories.enableMirror()
- dependencyResolutionManagement.repositories.enableMirror()
- }

Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。