博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
gradle 全局仓库
阅读量:7162 次
发布时间:2019-06-29

本文共 531 字,大约阅读时间需要 1 分钟。

hot3.png

在gradle的init.d目录下创建init.gradle,内容如下

allprojects{
    repositories {
        def REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public'
        all { ArtifactRepository repo ->
            def url = repo.url.toString()
            if ((repo instanceof MavenArtifactRepository) && (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
        }
    }
}

 

转载于:https://my.oschina.net/u/2323537/blog/836049

你可能感兴趣的文章