> ## Content Index
> Fetch the complete content index at: https://sgpublic.xyz/llms.txt
> Use this file to discover other available public pages before exploring further.

# Gradle 报错 Proxy returns "HTTP/1.1 407 Proxy Authentication Required" 解决
- URL: https://sgpublic.xyz/p/2026/04/6aac9cb1810a480001533617/
- Published: 2026-04-24T08:02:45.000Z
- Updated: 2026-09-18T04:59:25.000Z
- Author: Haven Madray
- Tags: 软件开发, Java/Kotlin, #wp-post

> 参考文献 [https://stackoverflow.com/a/64495153/18322863](https://stackoverflow.com/a/64495153/18322863?ref=sgpublic.xyz)

由于服务器所在的环境并非国际互联网环境，因此需要将代理运行在服务器上，而 Gradle 想要使用此代理，设置环境变量是无效的。

需要通过配置文件 `~/.gradle/gradle.properties`：

```
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=7890
systemProp.http.proxyUser=xxx
systemProp.http.proxyPassword=xxx

systemProp.https.proxyHost=127.0.0.1
systemProp.https.proxyPort=7890
systemProp.https.proxyUser=xxx
systemProp.https.proxyPassword=xxx

```

但实际使用的时候报错：

```
Exception in thread "main" java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy Authentication Required"

```

经过网上冲浪发现，JDK 默认禁止在隧道中用 Basic Auth 认证方式，而此处我正好使用的这种方式，因此还需要添加一行配置：

```
systemProp.jdk.http.auth.tunneling.disabledSchemes=""

```