文章目录
- 一、前言
- 二、遇到问题
- 三、分析问题
- 四、HTTP代理
- 五、重新编译验证
一、前言
遇到这个问题,有两种解决办法
- IDEA Maven使用HTTP代理,解决Could not transfer artifact org.xxx问题
- IDEA Maven使用国内镜像,解决Could not transfer artifact org.xxx问题
二、遇到问题
- 使用IDEA运行一个Java Demo时,遇到一个问题:
Could not transfer artifact org.xxx
Connection refused: connect
org.springframework.boot:spring-boot-starter-parent:pom:3.3.2 failed to transfer from https://repo.maven.apache.org/maven2 during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:3.3.2 from/to central (https://repo.maven.apache.org/maven2): transfer failed for https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/3.3.2/spring-boot-starter-parent-3.3.2.pom
Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:3.3.2 from/to central (https://repo.maven.apache.org/maven2): transfer failed for https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/3.3.2/spring-boot-starter-parent-3.3.2.pom
三、分析问题
根本原因就是https://repo.maven.apache.org/maven2
网址无法访问
四、HTTP代理
- 无法直接访问
https://repo.maven.apache.org/maven2
,那就开代理访问吧
- 打开代理后,再通过浏览器确定能够访问到
https://repo.maven.apache.org/maven2
- 在IDEA中HTTP配置了代理
五、重新编译验证
- 点击Maven刷新按钮,重新加载所有Maven项目
- Maven Clean
问题解决,撒花🎉~
觉得好,就一键三连呗(点赞+收藏+关注)