gradle构建项目时碰到的问题

问题1:

Exception in thread "main" java.io.IOException: Downloading from https://services.gradle.org/distributions/gradle-8.4-all.zip failed: timeout (10000ms)

下载超时,解决办法,本地开启代理,然后在 ~(用户家目录)/gradle文件夹 新建 gradle.properties文件,配置 gradle,内容为:

org.gradle.daemon=true
systemProp.https.proxyHost=localhost
systemProp.https.proxyPort=10809
systemProp.http.proxyHost=localhost
systemProp.http.proxyPort=10809
systemProp.https.nonProxyHosts=localhost

问题2

Switch Maven repository 'maven(http://maven.aliyun.com/nexus/content/groups/public/)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols.

去仓库下载的时候http请求被转发到了https,安全验证通不过,修改 ~/init.gradle,在maven配置中加上

maven {
  url REPOSITORY_URL
//加上这一句
  allowInsecureProtocol = true
}

这样就可以解决了

posted @ 2024-01-04 12:15  猝死的路上  阅读(549)  评论(0编辑  收藏  举报