赞
踩
一:问题描述如下:
pom中添加了依赖:commons-pool2:2.6.2 后出现包不能正常下载,手动导入后执行mvn install又出现如下错误:
[ERROR] Failed to execute goal on project imis-dss-nerm: Could not resolve dependencies for project
*.*.*:jar: Failed to collect dependencies at org.apache.commons:commons-p
ool2:jar:2.6.2: Failed to read artifact descriptor for org.apache.commons:commons-pool2:jar:2.6.2: C
ould not transfer artifact org.apache.commons:commons-pool2:pom:2.6.2 from/to repo2 (http://repo2.ma
ven.org/maven2/): repo2.maven.org: Unknown host repo2.maven.org -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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 read the following arti
cles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :***
二:解决方式
通过在stackoverflow查找 https://stackoverflow.com/questions/20608592/maven-install-error-dependency-could-not-be-resolved
发现是原先配置的maven仓库地址已不可用,更改为新地址即可:
早期配置:
<mirror> <id>repo2</id> <mirrorOf>central</mirrorOf> <name>Human Readable Name for this Mirror.</name> <url>http://repo2.maven.org/maven2/</url> </mirror> |
新配置:
<mirror> |
注意:使用此仓库需要安装证书,可参考:https://www.jianshu.com/p/672ba39fd3e1
或者使用下面两个地址:**https**
https://repo.maven.apache.org/maven2/
https://repo1.maven.org/maven2/
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。