Intelli下载Gradle返回Connect Time Out

文章目录

问题

打开intelliJ项目后,下载Gradle时返回Connect Time Out, 需要对gradle wrapper进行配置。

解决

我的IntelliJthsg版本:

IntelliJ IDEA 2023.2.4 (Community Edition)
Build #IC-232.10203.10, built on October 25, 2023
Runtime version: 17.0.8.1+7-b1000.32 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11.0
GC: G1 Young Generation, G1 Old Generation
Memory: 4056M
Cores: 12
Registry:
    ide.experimental.ui=true

Non-Bundled Plugins:
    Docker (232.10203.2)
    Lombook Plugin (232.10203.10)
    PythonCore (232.10203.2)

Kotlin: 232-1.9.0-IJ10203.10

1, 查找具体原因, 在IntelliJ中,菜单‘Help’ -> ‘Show Log in Explorer’,具体位置在C:\Users\username \AppData\Local\JetBrains\IdeaIC2023.2\log,查看idea.log文件,找到具体原因,是找不到Gradle的下载地址,设置为了本地一个源,需要设置一个正确的源。
2, 找到具体原因后,找到Gradle Wrapper的配置文件,具体位置为: C:\project_basedir\gradle\wrapper, 修改gradle-wrapper.properties这个配置文件,例如:

distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://your_repository_url/repository/gradle/distributions/gradle-8.7-bin.zip
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

注意以上distributionUrl地址要对,可访问, your_repository_url为示例。
问题解决,可以正常下载Gradle并编译。

参考

Stackoverflow: could not install Gradle distribution from ‘https://services.gradle.org/distributions/gradle-2.1-all.zip’
Stackoverflow: How to properly write a gradle-wrapper.properties file?

### IntelliJ IDEA 中 `connect timed out` 错误解决方案 当在 IntelliJ IDEA 中创建 Spring Boot 项目时遇到 `connect timed out` 错误,通常是因为网络连接问题阻止了 IDE 下载必要的依赖项。以下是几种可能的原因及其对应的解决办法: #### 使用国内镜像源配置 Maven 或 Gradle 如果默认的中央仓库无法访问,可以尝试切换到阿里云或其他国内镜像站点来加速下载过程[^1]。 对于Maven用户,在settings.xml文件中加入如下配置: ```xml <mirrors> <mirror> <id>aliyunmaven</id> <name>Aliyun Maven</name> <url>https://maven.aliyun.com/repository/public</url> <mirrorOf>central</mirrorOf> </mirror> </mirrors> ``` 对于Gradle用户,则可以在gradle.properties里添加: ```properties systemProp.http.proxyHost=repo.maven.apache.org systemProp.http.proxyPort=80 systemProp.https.proxyHost=repo.maven.apache.org systemProp.https.proxyPort=443 org.gradle.daemon=true // 更改为阿里云地址 systemProp.http.proxyHost=maven.aliyun.com systemProp.https.proxyHost=maven.aliyun.com ``` #### 修改IDEA中的HTTP代理设置 进入File -> Settings (Windows/Linux) or IntelliJ IDEA -> Preferences(Mac),导航至Appearance & Behavior->System Settings->HTTP Proxy部分,选择Auto-detect proxy settings或者手动指定proxy服务器信息[^2]。 #### 调整防火墙和杀毒软件规则 有时本地的安全防护措施也会干扰对外部资源的请求。确认防火墙允许IntelliJ IDEA通过,并且暂时关闭任何实时保护功能测试是否能解决问题;之后再考虑如何更精细地调整安全策略以兼容开发环境的需求。 #### 更新插件与重启服务 确保使用的Spring Assistant等相关插件处于最新版本状态。另外,有时候简单地重新启动计算机以及IDE本身就能让一些临时性的网络故障得到恢复[^3]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值