-
-
Save Macrow/2f34181533e103fb62955531501d78fd to your computer and use it in GitHub Desktop.
Android studio 统一替换JCenter为国内阿里云maven
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
摘要: jcenter替换为国内阿里云maven地址 | |
在你的USER_HOME/.gradle/目录下,新建一个文件init.gradle | |
把这一段内容拷贝进去 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
allprojects{ | |
repositories { | |
def REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public/' | |
all { ArtifactRepository repo -> | |
if(repo instanceof MavenArtifactRepository){ | |
def url = repo.url.toString() | |
if (url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('https://jcenter.bintray.com/')) { | |
project.logger.lifecycle "Repository ${repo.url} replaced by $REPOSITORY_URL." | |
remove repo | |
} | |
} | |
} | |
maven { | |
url REPOSITORY_URL | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment