Maven报错Read timed out
本文最后更新于 2024-08-27,文章内容可能已经过时。
一、问题描述
在国内连接Maven官方中央库会出现Connection timed out问题。
[ERROR] Failed to execute goal on project gs-maven: Could not resolve dependencies for project org.springframework:gs-maven:jar:0.1.0: Failed to collect dependencies at joda-time:joda-time:jar:2.2: Failed to read artifact descriptor for joda-time:joda-time:jar:2.2: Could not transfer artifact joda-time:joda-time:pom:2.2 from/to central (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.16.215] failed: Connection timed out: connect -> [Help 1]
二、解决方案
在配置文件(默认为.m2/settings.xml)中添加国内镜像站
<mirror>
<id>nexus-aliyun</id>
<mirrorOf>*</mirrorOf>
<name>Nexus aliyun</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror>
本文是原创文章,采用 CC BY-NC-ND 4.0 协议,完整转载请注明来自 心流铭刻
评论
匿名评论
隐私政策
你无需删除空行,直接评论以获取最佳展示效果