gradle 不再同步插件

gradle won't sync plugins anymore

Gradle 今天是 运行 一项实验,他们禁用所有 HTTP 通信:https://blog.gradle.org/decommissioning-http

昨天,我可以很好地同步我的项目;我没有使用代理或任何其他 'funky' 设置。

buildscript {
    ext {
        ...
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        ...
    }
}

plugins {
    id "com.palantir.docker" version "0.20.1"
}

repositories {
    mavenCentral()
}

虽然昨天我可以下载依赖项 (--refresh-dependencies),但今天它不起作用。 ./gradlew clean build --refresh-dependencies 现在失败并出现错误:

* What went wrong:
A problem occurred configuring root project 'myproject-backend'.
> Could not resolve all artifacts for configuration ':classpath'.
   > Could not resolve gradle.plugin.com.palantir.gradle.docker:gradle-docker:0.20.1.
     Required by:
         project : > com.palantir.docker:com.palantir.docker.gradle.plugin:0.20.1
      > Could not resolve gradle.plugin.com.palantir.gradle.docker:gradle-docker:0.20.1.
         > Could not get resource 'https://plugins.gradle.org/m2/gradle/plugin/com/palantir/gradle/docker/gradle-docker/0.20.1/gradle-docker-0.20.1.pom'.
            > Could not HEAD 'https://plugins.gradle.org/m2/gradle/plugin/com/palantir/gradle/docker/gradle-docker/0.20.1/gradle-docker-0.20.1.pom'.
               > peer not authenticated

它也与这个特定插件无关,我所有其他项目也不会同步(例如spring插件无法同步,flyway插件无法同步等)。

我尝试将 gradle 版本升级到新的 6.0,但这也无济于事。 关于如何解决这个问题有什么建议吗?

谢谢。

// 编辑:我的 gradle-wrapper.properties 文件如下所示:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

可能与您的java版本有关。

Gradle 在 plugins.gradle.org 的 14.11.2019 上添加了对 TLSv3 的支持(并禁用了 TLSv1.0),似乎 "old" Java 版本有问题有了它:

https://status.gradle.com/incidents/q2vq49fndxg0

对我们来说,11.0.1 失败了,我们不得不升级到 11.0.5