在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
<省略...>