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

时间:2015-02-25 17:06:55

标签: 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




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

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

4 个答案:

答案 0 :(得分:5)

DependencyResolutionException

(来源:Maven Confluence

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

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

答案 1 :(得分:1)

您的远程存储库都有域maven.apps.com,是您Intranet中的域吗? Nexus是否作为Maven中心的镜像运行?

如果没有,您可以尝试暂时删除settings.xml并查看默认设置是否成功。

答案 2 :(得分:1)

我遇到了这个问题,maven无法下载任何内容。经过一些谷歌搜索和一些运气,我删除了文件〜/ .m2 / server.xml。这解决了问题。我之前没有碰过那个文件,不知道问题是什么。

答案 3 :(得分:0)

我遇到了同样的问题,结果我的 settings.xml 文件位于 c:.m2\ 文件夹中。一旦我将它移到用户个人资料下,它就会像魅力一样工作。 也许是因为位置相关。

相关问题