【发布时间】:2022-11-10 17:44:05
【问题描述】:
这个问题专门针对Gradle 包装器而不是完整的 Gradle 安装。
我的公司强迫我使用代理来访问许多 url,而解决超时问题通常需要的只是配置任何试图访问所述 url 的东西以使用代理,之后我得到一个证书验证错误,我也必须这样做将站点的 SSL 证书添加到 Java 的密钥库中(以 this answer 为例说明如何执行后者)。
但是,使用 Gradle 包装器(版本 7.4.1+),我仍然会超时。
我搜索了一下,发现很多人似乎有这个问题。不过,他们中的大多数只需要在 gradle.properties 文件中配置代理(在 Windows 上,默认情况下在 %userprofile%\.gradle 中):
systemProp.http.proxyHost=the proxy host
systemProp.http.proxyPort=the port
systemProp.http.proxyUser=username (if authentication is needed)
systemProp.http.proxyPassword=password (if authentication is needed)
systemProp.https.proxyHost=the proxy host
systemProp.https.proxyPort=the port
systemProp.https.proxyUser=username (if authentication is needed)
systemProp.https.proxyPassword=password (if authentication is needed)
或者,他们必须从文件中删除错误的代理配置。
他们中的一些人通过使用以下属性增加 Gradle 的超时来解决问题:
systemProp.org.gradle.internal.http.connectionTimeout=300000
systemProp.org.gradle.internal.http.socketTimeout=300000
这些解决方案对我不起作用。为什么?
【问题讨论】:
标签: gradle proxy gradle-wrapper