【Gradle】IDEA Gradle使用Maven仓库的方法
1.在自己的电脑上找到如:D:\Lucifer\.gradle的gradle缓存文件夹,新建文件init.gradle
2.复制粘贴在init.gradle中,保存即可。
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
}
}
}
还没有评论,来说两句吧...