zoukankan      html  css  js  c++  java
  • 在init.gradle使用阿里云gradle-plugin代替plugins.gradle.org

        本人已在gradle 3.3下测试可用,使用3.3版本主要是调试elasticsearch 5.5用的。

    init.gradle

    allprojects{
        repositories {
            def ALIYUN_REPOSITORY_URL = 'https://maven.aliyun.com/repository/central/'
            def ALIYUN_JCENTER_URL = 'https://maven.aliyun.com/repository/jcenter/'
            all { ArtifactRepository repo ->
                if(repo instanceof MavenArtifactRepository){
                    def url = repo.url.toString()
                    if (url.startsWith('https://repo1.maven.org/maven2/')) {
                        project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."
                        remove repo
                    }
                    if (url.startsWith('https://jcenter.bintray.com/')) {
                        project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."
                        remove repo
                    }
                }
            }
            maven { url ALIYUN_REPOSITORY_URL }
            maven { url ALIYUN_JCENTER_URL }
        }
    
        buildscript {
            repositories {
                def ALIYUN_GRADLE_PLUGIN_URL = 'https://maven.aliyun.com/repository/gradle-plugin/'
                all { ArtifactRepository repo ->
                    if(repo instanceof MavenArtifactRepository){
                        def url = repo.url.toString()
                        if (url.startsWith('https://plugins.gradle.org/m2/')) {
                            project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_GRADLE_PLUGIN_URL."
                            remove repo
                        }
                    }
                }
                maven { url ALIYUN_GRADLE_PLUGIN_URL }
            }
        }
    }

    output:

    <省略...>
    Repository https://plugins.gradle.org/m2/ replaced by https://maven.aliyun.com/repository/gradle-plugin/. Download https://maven.aliyun.com/repository/gradle-plugin/com/github/jengelman/gradle/plugins/shadow/1.2.3/shadow-1.2.3.pom Download https://maven.aliyun.com/repository/gradle-plugin/org/jdom/jdom2/2.0.5/jdom2-2.0.5.pom Download https://maven.aliyun.com/repository/gradle-plugin/org/ow2/asm/asm/5.0.3/asm-5.0.3.pom Download https://maven.aliyun.com/repository/gradle-plugin/org/ow2/asm/asm-parent/5.0.3/asm-parent-5.0.3.pom Download https://maven.aliyun.com/repository/gradle-plugin/org/ow2/ow2/1.3/ow2-1.3.pom Download https://maven.aliyun.com/repository/gradle-plugin/org/ow2/asm/asm-commons/5.0.3/asm-commons-5.0.3.pom Download https://maven.aliyun.com/repository/gradle-plugin/org/apache/ant/ant/1.9.4/ant-1.9.4.pom Download https://maven.aliyun.com/repository/gradle-plugin/org/apache/ant/ant-parent/1.9.4/ant-parent-1.9.4.pom Download https://maven.aliyun.com/repository/gradle-plugin/org/codehaus/plexus/plexus-utils/2.0.6/plexus-utils-2.0.6.pom Download https://maven.aliyun.com/repository/gradle-plugin/org/codehaus/groovy/groovy-backports-compat23/2.4.4/groovy-backports-compat23-2.4.4.pom Download https://maven.aliyun.com/repository/gradle-plugin/org/ow2/asm/asm-tree/5.0.3/asm-tree-5.0.3.pom Download https://maven.aliyun.com/repository/gradle-plugin/org/apache/ant/ant-launcher/1.9.4/ant-launcher-1.9.4.pom Download https://maven.aliyun.com/repository/gradle-plugin/com/github/jengelman/gradle/plugins/shadow/1.2.3/shadow-1.2.3.jar Download https://maven.aliyun.com/repository/gradle-plugin/org/jdom/jdom2/2.0.5/jdom2-2.0.5.jar
    Download https://maven.aliyun.com/repository/gradle-plugin/org/ow2/asm/asm/5.0.3/asm-5.0.3.jar
    <省略...>
  • 相关阅读:
    转dhdhtmlxTree
    转Merge的用法
    解决SqlServer2008评估期过期
    借鉴一下对比算法
    Asp.Net异常:"由于代码已经过优化或者本机框架位于调用堆栈之上,无法计算表达式的值"的解决方法
    查看Windows下引起Oracle CPU占用率高的神器-qslice
    今日有奖活动一览
    【分享】给做技术的战友们推荐一个不错的微信公号解解闷
    Unreal Engine Plugin management
    当在ECLIPSE中import现存项目时,如遇到版本不符
  • 原文地址:https://www.cnblogs.com/highend/p/gradle_plugins_use_aliyun_mirror.html
Copyright © 2011-2022 走看看