码迷,mamicode.com
首页 > 其他好文 > 详细

gradle 阿里全局镜像配置

时间:2017-12-29 19:03:03      阅读:484      评论:0      收藏:0      [点我收藏+]

标签:阿里云   life   url   int   col   国内   placed   span   com   

使用国内镜像阿里云,全局配置USER_HOME/.gradle/文件夹下,创建文件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
        }
    }
}

 

gradle 阿里全局镜像配置

标签:阿里云   life   url   int   col   国内   placed   span   com   

原文地址:https://www.cnblogs.com/chuancheng/p/8145785.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!