Gradle本站镜像

使用Android Studio开发,最痛苦的其中一项是Maven下载数据缓慢,目前已经可以根据在Ubuntu 14.04 系统中的Apache Tomcat上部署Apache Archiva 2.2.1来使用本站的代理服务器的方式进行提速了。另一个痛苦的事情就是下载Gradle工具包的速度异常缓慢了,不仅慢,而且还容易失败。
目前本网站已经提供了Gradle工具包的下载代理,具体的操作就是把services.gradle.org进行域名污染,指向本站的IP地址121.199.27.227
Windows下的解决方法为修改C:\Windows\System32\drivers\etc下的hosts文件,里面增加如下内容:

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#	127.0.0.1       localhost
#	::1             localhost
121.199.27.227 services.gradle.org

接着修改Android Studio项目下的gradle\wrapper\gradle-wrapper.properties文件,把其中的

#Tue Aug 16 10:46:15 CST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip

修改为:

#Tue Aug 16 10:46:15 CST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-2.14.1-all.zip

注意,上面的修改其实主要是把HTTPS修改成了HTTP,原因在于HTTPS无法进行域名污染。

当然,另外一个比较简单的修改方式为,只要修改distributionUrl为本站地址,更加省事:

#Tue Aug 16 10:46:15 CST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://www.mobibrw.com/distributions/gradle-2.14.1-all.zip

目前本站提供的Gradle工具包版本如下:

gradle-2.10-all.zip.sha256
gradle-2.10-all.zip

gradle-2.14.1-all.zip.sha256
gradle-2.14.1-all.zip

gradle-6.6-all.zip.sha256
gradle-6.6-all.zip

gradle-8.2.1-all.zip

当前更建议大家使用 腾讯的国内镜像 https://mirrors.cloud.tencent.com/gradle/

参考链接


gradle不同版本下载太慢---腾讯做了国内镜像可以直接下载

发布者

《Gradle本站镜像》上有3条评论

  1. 博主您好,
    你解决的问题我也深有同感,目前我正在使用Tomcat 8 搭建本地的gradle文件下载服务,但是我不管是使用http还是https都报错,使用http报500的错,使用https报授权相关的错误。麻烦您能介绍一下你搭建的方法么?

    1. http如果报告500错误,那么应该是服务返回了异常,需要查看服务器的日志,而对于https,则要求必须是有正确的证书的,而且必须是能正常访问的才可以,也是需要查看服务器的日志

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注