title: 解决 IDEA 下载源码失败的问题maven-default-http-blocker (http://0.0.0.0/) Blocked mirror for repositories
date: 2022-01-25 00:00:00
tags:
- 问题
- IDE使用
categories: - Maven
今天发现在 IDEA 中下载源码失败,通过查看 IDEA 日志看到了出错的原因:
tail -f ~/Library/Logs/JetBrains/IntelliJIdea2021.3/idea.log
再次单击下载源码按钮后实时输出:
2022-01-25 17:23:15,247 [ 135367] INFO - #org.jetbrains.idea.maven - org.eclipse.aether.resolution.ArtifactResolutionException: Could not transfer artifact org.springframework:spring-webmvc:jar:sources:5.3.15 from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories: [nexus-aliyun (http://maven.aliyun.com/nexus/content/groups/public, default, releases)]
in DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:424)
Caused by: org.eclipse.aether.transfer.ArtifactTransferException: Could not transfer artifact org.springframework:spring-webmvc:jar:sources:5.3.15 from/to maven-default-http-blocker (http://0.0.0.0/): Blocked mirror for repositories: [nexus-aliyun (http://maven.aliyun.com/nexus/content/groups/public, default, releases)]
in DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520)
... 24 more
Caused by: org.eclipse.aether.transfer.NoRepositoryConnectorException: Blocked mirror for repositories: [nexus-aliyun (http://maven.aliyun.com/nexus/content/groups/public, default, releases)]
in DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:506)
... 25 more
查到是 maven 3.8.1 版本带来的限制,详见版本说明。
最后解决这个问题也比较简单,使用https协议的仓库地址即可:vim ~/.m2/settings.xml
。
170 <mirror>
171 <id>nexus-aliyun</id>
172 <mirrorOf>central</mirrorOf>
173 <name>Nexus aliyun</name>
174 <url>https://maven.aliyun.com/nexus/content/groups/public</url>
175 </mirror>