美文网首页
gradle仓库地址全局替换

gradle仓库地址全局替换

作者: kdroid | 来源:发表于2017-02-22 10:42 被阅读589次

    在 ${USER_HOME}.gradle 新建init.gradle

    allprojects{
        repositories {
            def REPOSITORY_URL = 'http://maven.oschina.net/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仓库地址全局替换

          本文链接:https://www.haomeiwen.com/subject/jcwpwttx.html