我在我的项目上尝试了 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 中的代理设置,我觉得这就是问题所在。但是我尝试了相同的代理设置来构建其他开源软件项目并且构建成功。但是对于这个项目,我看到了这个错误。
谁能对这个问题给出一个想法。
最佳答案
依赖解析异常
(来源:Maven Confluence)
这个错误一般发生在Maven无法下载依赖的时候。此错误的可能原因是:
- POM 遗漏了
<repository>
的声明托管工件。 - 您配置的存储库需要身份验证,而 Maven 未能向服务器提供正确的凭据。在这种情况下,请确保您的
${user.home}/.m2/settings.xml
包含<server>
声明其<id>
匹配<id>
要使用的远程存储库。查看Maven Settings Reference了解更多详情。 - 有问题的远程存储库使用 SSL,而运行 Maven 的 JVM 不信任服务器的证书。
- 存在阻止 Maven 访问任何远程存储库的一般网络问题,例如缺少代理配置。
- 您已将 Maven 配置为执行严格的校验和验证,但要下载的文件已损坏。
- Maven 无法将文件保存到您的本地存储库,请参阅
LocalRepositoryNotAccessibleException
了解更多详情。 - 在 Maven 3 中,如果您刚刚下载失败并已修复它(例如,通过将 jar 上传到存储库),它将缓存失败。要强制刷新,请添加
-U
到命令行。
如果是一般的网络相关问题,您还可以引用以下文章:
关于java - Maven 全新安装失败,连接超时 :connect error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28725195/