Mac brew install gradle一直卡

雨燕双飞 提交于 2020-10-03 11:55:49

先到官网下载gradle最新版

https://gradle.org/releases

执行brew install gradle

brew install gradle
==> Downloading https://services.gradle.org/distributions/gradle-6.6.1-all.zip
==> Downloading from https://downloads.gradle-dn.com/distributions/gradle-6.6.1-
###                                                                        5.5%^C

卡 ~卡~卡 直接取消就好了,然后输入下面命令

brew --cache gradle
/Users/way/Library/Caches/Homebrew/downloads/1aae952c51910aa4f2d6f13f80dcfc90ece8a11490f5e43cc8ee880755b65dc9--gradle-6.6.1-all.zip

重点来了

把下载好的gradle直接复制到/Users/way/Library/Caches/Homebrew/downloads路径下面,名字替换成1aae952c51910aa4f2d6f13f80dcfc90ece8a11490f5e43cc8ee880755b65dc9–gradle-6.6.1-all.zip.incomplete
替换好后继续

brew install gradle
brew install gradle
==> Downloading https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles/bottles/op
Already downloaded: /Users/way/Library/Caches/Homebrew/downloads/183892c67b2607e4fa70e2cd709aad507b3fcbfb3a68b064639190017f8219fe--openjdk-14.0.1.high_sierra.bottle.tar.gz
==> Downloading https://services.gradle.org/distributions/gradle-6.6.1-all.zip
Already downloaded: /Users/way/Library/Caches/Homebrew/downloads/1aae952c51910aa4f2d6f13f80dcfc90ece8a11490f5e43cc8ee880755b65dc9--gradle-6.6.1-all.zip.incomplete.zip
Error: SHA256 mismatch
Expected: 11657af6356b7587bfb37287b5992e94a9686d5c8a0a1b60b87b9928a2decde5
  Actual: 04e1f6983335781032814c4537534fbca89a57799eda0c6567845f552c5315d5
 Archive: /Users/way/Library/Caches/Homebrew/downloads/1aae952c51910aa4f2d6f13f80dcfc90ece8a11490f5e43cc8ee880755b65dc9--gradle-6.6.1-all.zip.incomplete.zip
To retry an incomplete download, remove the file above.

提示sha256校验不对

brew edit gradle
lass Gradle < Formula
  desc "Open-source build automation tool based on the Groovy and Kotlin DSL"
  homepage "https://www.gradle.org/"
  url "https://services.gradle.org/distributions/gradle-6.6.1-all.zip"
  sha256 "11657af6356b7587bfb37287b5992e94a9686d5c8a0a1b60b87b9928a2decde5"
  license "Apache-2.0"

  livecheck do
    url "https://services.gradle.org/distributions/"
    regex(/href=.*?gradle[._-]v?(\d+(?:\.\d+)+)-all\.(?:[tz])/i)
  end

  bottle :unneeded

  depends_on "openjdk"

  def install
    rm_f Dir["bin/*.bat"]
    libexec.install %w[bin docs lib src]
    (bin/"gradle").write_env_script libexec/"bin/gradle", Language::Java.overridable_java_home_env
  end

<cal/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/gradle.rb" 33L, 1014C

直接用之前提示实际sha256替换掉sha256 “11657af6356b7587bfb37287b5992e94a9686d5c8a0a1b60b87b9928a2decde5”

OK

brew install gradle
==> Downloading https://services.gradle.org/distributions/gradle-6.6.1-all.zip
Already downloaded: /Users/way/Library/Caches/Homebrew/downloads/1aae952c51910aa4f2d6f13f80dcfc90ece8a11490f5e43cc8ee880755b65dc9--gradle-6.6.1-all.zip.incomplete.zip
🍺  /usr/local/Cellar/gradle/6.6.1: 10,630 files, 249.3MB, built in 19 seconds
==> `brew cleanup` has not been run in 30 days, running now...
Removing: /Users/way/Library/Caches/Homebrew/mono--6.8.0.105.high_sierra.bottle.tar.gz... (142.6MB)
Removing: /Users/way/Library/Caches/Homebrew/paket--5.236.0.exe... (8.3MB)
Removing: /Users/way/Library/Logs/Homebrew/paket... (64B)
Removing: /Users/way/Library/Logs/Homebrew/mono... (64B)
Pruned 1 symbolic links and 10 directories from /usr/local
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!