连接到 Maven 存储库时连接超时

Posted

技术标签:

【中文标题】连接到 Maven 存储库时连接超时【英文标题】:Connection timing out while connecting to Maven repository 【发布时间】:2017-06-04 23:12:02 【问题描述】:

我正在尝试使用以下命令在本地系统中构建我的项目

mvn clean install -Dmaven.test.skip=true

它失败并出现以下错误。它无法连接到 repo.maven.apache.org。

我 ping 服务器 repo.maven.apache.org,我可以看到回复。

我正在使用 maven 3 版本并连接到 maven 2 repo (repo.maven.apache.org)。

  [INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building web-order-a*** 1702.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: **https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-clean-plugin/2.5/maven-clean-plugin-2.5.pom**
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 21.778 s
[INFO] Finished at: 2017-01-19T21:21:10-06:00
[INFO] Final Memory: 6M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its 
dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-clean-plugin:jar:2.5: 
Could not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central
 (https://repo.maven.apache.org/maven2): Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.56.215] failed: Connection timed out: connect -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException

如果有人能就我的系统出了什么问题提出建议,那就太好了?

【问题讨论】:

没有从这个***.com/questions/28725195/…得到帮助 我尝试了帖子中建议的所有解决方案。但它们都不起作用。 如果您在浏览器中连接到repo.maven.apache.org/maven2 是否有效?如果不是,那么它与 Maven 无关。这只是你的网络问题。如果可以,请检查是否需要在 Maven 中设置代理。 是的,我可以在浏览器中访问repo.maven.apache.org/maven2。我可以看到该网站中的所有文件夹。 您的网络连接似乎正在使用代理。是这样吗? 【参考方案1】:

我遇到了同样的问题,就像 cmets 建议的那样,它是 maven 代理。在 \conf\settings.xml 中设置

http://maven.apache.org/guides/mini/guide-proxies.html

【讨论】:

以上是关于连接到 Maven 存储库时连接超时的主要内容,如果未能解决你的问题,请参考以下文章

远程调试:无法连接到远程虚拟机。连接超时

ping 路由器 出现 间断的 请求超时或者是无法连接到 目标主机。

从SecureCRT连接到虚拟机失败。提示连接超时。求解决办法。200分。

如何设置远程连接到 postgresql 数据库的 jdbc 连接超时值?

ssh 服务器连接到主机 xxx 端口 22:linux-ubuntu 上的连接超时

java.net.ConnectException:无法连接到 /10.0.0.2(端口 80):连接失败:ETIMEDOUT(连接超时)