Maven安装错误:无法解析依赖项
我使用的是Maven 3.1.1。当我运行Maven安装错误:无法解析依赖项,maven,maven-3,Maven,Maven 3,我使用的是Maven 3.1.1。当我运行mvn install时,出现以下错误: D:\spring source>mvn install [INFO] Scanning for projects... [INFO] [INFO] ------------------------------------------------------------------------ [INFO] Building SpringDependencies 1.0 [INFO] -----------
mvn install
时,出现以下错误:
D:\spring source>mvn install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building SpringDependencies 1.0
[INFO] ------------------------------------------------------------------------
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-
dependency-plugin/2.8/maven-dependency-plugin-2.8.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.648s
[INFO] Finished at: Mon Dec 16 15:01:47 IST 2013
[INFO] Final Memory: 4M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-dependency-plugin:2.8 or one of it
s dependencies could not be resolved: Failed to read artifact descriptor for org
.apache.maven.plugins:maven-dependency-plugin:jar:2.8: Could not transfer artifa
ct org.apache.maven.plugins:maven-dependency-plugin:pom:2.8 from/to central (htt
p://repo.maven.apache.org/maven2): repo.maven.apache.org: Unknown host repo.mave
n.apache.org -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResoluti
onException
我的pom.xml
是:
4.0.0
spring源代码下载
SpringDependencies
1
UTF-8
org.springframework
spring上下文
4.0.0.0发布
org.apache.maven.plugins
maven依赖插件
3.1.1
下载依赖项
产生资源
复制依赖项
${project.build.directory}/dependencies
无法转移工件
plugins:maven依赖插件:pom:2.8 from/to
central():repo.maven.apache.org:
未知主机repo.maven.apache.org
您的maven似乎无法访问远程中央存储库
- 检查您是否已建立internet连接
- 检查是否可以在浏览器中访问默认maven repo李>
- 检查
中的配置是否正确,以及设置.xml中的
是否正确
您可以使用Exclutions标记排除依赖项的可传递包含。此错误是由于代理设置引起的 首先,检查您是否能够从浏览器连接到maven repository() 然后使用以下详细信息更新.m2目录中的Maven proxy setting create/update a settings.xml:
<proxies>
<proxy>
<active>true</active>
<protocol>http</protocol>
<host>{your proxy server host name}</host>
<port>{your proxy server port}</port>
<nonProxyHosts>maven</nonProxyHosts>
</proxy>
</proxies>
这是由maven或插件文件夹损坏引起的。要解决这个问题:
删除\.m2\repository\org\apache\maven
mvn依赖项:解析-X
通过在.m2/settings.xml中提供正确的代理主机,我们解决了这个问题
例如:
<proxies>
<proxy>
<id>XXXXXXXXXX</id>
<active>true</active>
<protocol>http</protocol>
<host>na-xxxx-proxy.na.xxxxxxxxxx.net</host>
<port>80</port>
<nonProxyHosts>localhost|10.140.240.90.*</nonProxyHosts>
</proxy>
</proxies>
XXXXXXXXX
真的
http
na-xxxx-proxy.na.XXXXXXXXX.net
80
localhost | 10.140.240.90*
my Settings.xml在哪里?
Windows用户
它位于您的C:/Users//.m2/settings.xml
<proxies>
<proxy>
<id>proxy-id</id>
<active>true</active>
<protocol>http</protocol>
<host>ca-something.net</host>
<port>80</port>
<nonProxyHosts>localhost|10.140.240.90.*</nonProxyHosts>
</proxy>
</proxies>
此外,这是针对特定用户的。
Global one可在以下地点提供:
/conf/settings.xml
<proxies>
<proxy>
<id>proxy-id</id>
<active>true</active>
<protocol>http</protocol>
<host>ca-something.net</host>
<port>80</port>
<nonProxyHosts>localhost|10.140.240.90.*</nonProxyHosts>
</proxy>
</proxies>
但是,如果找不到全局用户,那么更改用户一可能会解决这个问题
同样重要的是,转到Eclipse/STS中的首选项:
- 转到Maven->用户设置
并验证属性中是否同时提到了global和user settings.xml文件(如果没有通过浏览提及)
1.代理发行
检查。
如果您的计算机正在使用任何代理,那么您也需要在settings.xml文件中添加代理设置
只需将这段代码添加到settings.xml
<proxies>
<proxy>
<id>proxy-id</id>
<active>true</active>
<protocol>http</protocol>
<host>ca-something.net</host>
<port>80</port>
<nonProxyHosts>localhost|10.140.240.90.*</nonProxyHosts>
</proxy>
</proxies>
现在该走了
3.以上都不管用
尝试断开任何公司专用VPN的连接,然后尝试从VPN断开连接,然后运行命令。My
块被注释掉。但我使用代理服务器连接到互联网。所以我认为这就是问题所在。在settings.xml中,您可以指定您的代理:block
是一个可能的解决方案,因为它对我有效。要补充以上几点,internet连接可能会间歇性关闭。几分钟后再试。这是的副本