问题描述
我在项目上尝试了maven全新安装,每次遇到以下错误时,我都会
I tried maven clean install on my project and I every time I get the following error
Maven版本2.2.1JDK 1.7
Maven version 2.2.1JDK 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中的代理设置,我的感觉是问题所在.但是我尝试了相同的代理设置来构建其他开源软件项目,并且构建成功.但是对于这个项目,我看到了这个错误.
I have checked the proxy settings in settings.xml and I my feeling is that's the problem. But I have tried the same proxy settings to build other open source software projects and the build was success. But for this project, I see this error.
有人可以对这个问题有个想法吗?
Can someone give an idea on this problem.
推荐答案
DependencyResolutionException
(来源: Maven Confluence )
当Maven无法下载依赖项时,通常会发生此错误.导致此错误的可能原因是:
This error generally occurs when Maven could not download dependencies. Possible causes for this error are:
- POM缺少托管工件的
<repository>
的声明. - 您配置的存储库需要身份验证,并且Maven无法向服务器提供正确的凭据.在这种情况下,请确保您的
${user.home}/.m2/settings.xml
包含一个<server>
声明,该声明的<id>
与要使用的远程存储库的<id>
相匹配.有关更多详细信息,请参见 Maven设置参考. - 有问题的远程存储库使用SSL,运行Maven的JVM不信任服务器的证书.
- 存在一个普遍的网络问题,该问题阻止Maven访问任何远程存储库,例如缺少代理配置.
- 您已将Maven配置为执行严格的校验和验证,并且下载的文件已损坏.
- Maven无法将文件保存到本地存储库,请参阅
LocalRepositoryNotAccessibleException
有关更多详细信息. - 在Maven 3中,如果您刚刚下载失败并已将其修复(例如,通过将jar上传到存储库),则它将缓存失败.要强制刷新,请在命令行中添加
-U
.
- The POM misses the declaration of the
<repository>
which hosts the artifact. - The repository you have configured requires authentication and Maven failed to provide the correct credentials to the server. In this case, make sure your
${user.home}/.m2/settings.xml
contains a<server>
declaration whose<id>
matches the<id>
of the remote repository to use. See the Maven Settings Reference for more details. - The remote repository in question uses SSL and the JVM running Maven does not trust the certificate of the server.
- There is a general network problem that prevents Maven from accessing any remote repository, e.g. a missing proxy configuration.
- You have configured Maven to perform strict checksum validation and the files to download got corrupted.
- Maven failed to save the files to your local repository, see
LocalRepositoryNotAccessibleException
for more details. - In Maven 3 if you just had a failed download and have fixed it (e.g. by uploading the jar to a repository) it will cache the failure. To force a refresh add
-U
to the command line.
如果遇到与网络相关的一般性问题,您还可以查阅以下文章:
In case of a general network-related problem, you could also consult the following articles:
- Configuring a Proxy
- Security and Deployment Settings
- Guide to Remote Repository Access through Authenticated HTTPS
这篇关于Maven全新安装失败,连接超时:连接错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!