Maven干净安装失败并且连接超时:连接错误

use*_*658 1 java maven-2 pom.xml connection-timeout

我在我的项目上尝试了maven clean install,每次出现以下错误时都是如此

Maven版本2.2.1 JDK 1.7

F:\Wealth>"C:\Program Files\apache-maven-2.2.1\bin\mvn.bat" cl
ean install -U
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building polo
[INFO]    task-segment: [clean, install]
[INFO] ------------------------------------------------------------------------
Downloading: http://maven.apps.com/maven2/org/apache/maven/plugins/maven-cle
an-plugin/2.2/maven-clean-plugin-2.2.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository nunki (http://maven.apps.com/maven2): Error transferring file: Connection timed out: connect
Downloading: http://maven.apps.com/maven/org.apache.maven.plugins/poms/maven
-clean-plugin-2.2.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository nunki-legacy (http://maven.apps.com/maven): Error transferring file: Connection timed out: connect
Downloading: http://maven.apps.com/maven2//org/apache/maven/plugins/maven-clean-plugin/2.2/maven-clean-plugin-2.2.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository central (http://repo1.maven.org/maven2): Error transferring file: Connection timed out: connect
Downloading: http://maven.apps.com/maven2/org/apache/maven/plugins/maven-cle
an-plugin/2.2/maven-clean-plugin-2.2.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository nunki (http://maven.apps.com/maven2): Error transferring file: Connection timed out: connect
Downloading: http://maven.apps.com/maven/org.apache.maven.plugins/poms/maven
-clean-plugin-2.2.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository nunki-legacy (http://maven.apps.com/maven): Error transferring file: Connection timed out: connect
Downloading: http://maven.apps.com/maven2//org/apache/maven/plugins/maven-cl
ean-plugin/2.2/maven-clean-plugin-2.2.pom
[WARNING] Unable to get resource 'org.apache.maven.plugins:maven-clean-plugin:pom:2.2' from repository central (http://repo1.maven.org/maven2): Error transferring file: Connection timed out: connect
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: org.apache.maven.plugins:maven-clean-plugin

Reason: POM 'org.apache.maven.plugins:maven-clean-plugin' not found in repository: Unable to download the artifact from any repository

  org.apache.maven.plugins:maven-clean-plugin:pom:2.2

from the specified remote repositories:
  nunki-legacy (http://maven.apps.com/maven),
  central (http://maven.apps.com/maven2/),
  nunki (http://maven.apps.com/maven2)

 for project org.apache.maven.plugins:maven-clean-plugin
Run Code Online (Sandbox Code Playgroud)

我已经检查了settings.xml中的代理设置,我觉得这就是问题所在.但我尝试了相同的代理设置来构建其他开源软件项目,并且构建成功.但对于这个项目,我看到了这个错误.

有人可以就这个问题提出想法.

naX*_*aXa 5

DependencyResolutionException

(来源:Maven Confluence)

当Maven无法下载依赖项时,通常会发生此错误.导致此错误的可能原因是:

  1. POM错过了<repository>托管工件的声明.
  2. 您配置的存储库需要身份验证,Maven无法向服务器提供正确的凭据.在这种情况下,请确保${user.home}/.m2/settings.xml包含与要使用的远程存储库匹配的<server>声明.有关详细信息,请参阅Maven设置参考.<id><id>
  3. 有问题的远程存储库使用SSL,运行Maven的JVM不信任服务器的证书.
  4. 存在阻止Maven访问任何远程存储库的一般网络问题,例如缺少代理配置.
  5. 您已将Maven配置为执行严格的校验和验证,并且要下载的文件已损坏.
  6. Maven无法将文件保存到本地存储库,LocalRepositoryNotAccessibleException有关详细信息,请参阅.
  7. 在Maven 3中,如果您刚刚下载失败并修复了它(例如通过将jar上传到存储库),它将缓存失败.强制刷新添加-U到命令行.

如果遇到与网络相关的一般问题,您还可以参考以下文章:

  • 在[$ {user.home} /.m2/settings.xml](http://maven.apache.org/guides/mini/guide-proxies.html)文件中设置正确的代理解决了该问题. (2认同)