Gradle项目无法下载jar包

Gradle大约 1084 字

报错信息

* What went wrong:
A problem occurred configuring root project 'MyApp'.
> Could not resolve all files for configuration ':classpath'.
   > Could not download jimfs.jar (com.google.jimfs:jimfs:1.1)
      > Could not get resource 'https://plugins.gradle.org/m2/com/google/jimfs/jimfs/1.1/jimfs-1.1.jar'.
         > Could not HEAD 'https://plugins.gradle.org/m2/com/google/jimfs/jimfs/1.1/jimfs-1.1.jar'.
            > Connect to d29vzk4ow07wi7.cloudfront.net:443 [d29vzk4ow07wi7.cloudfront.net/54.192.84.6, d29vzk4ow07wi7.cloudfront.net/54.192.84.168, d29vzk4ow07wi7.cloudfront.net/54.192.84.128, d29vzk4ow07wi7.cloudfront.net/54.192.84.173] failed: Read timed out

修改配置

Gradle的默认仓库:https://plugins.gradle.org/m2/

修改默认仓库为其他可用镜像。

在根目录的settings.gradle中添加pluginManagement节点。注意:必须放置在rootProject.name属性前。

pluginManagement {
    repositories {
        maven {
            url 'http://examle.com/maven-repo'
        }
        gradlePluginPortal()
    }
}

rootProject.name = 'test-project-name'

参考

https://docs.gradle.org/current/userguide/plugins.html#sec:plugin_management

阅读 33 · 发布于 2020-11-16

————        END        ————

扫描下方二维码关注公众号和小程序↓↓↓

昵称:
随便看看换一批