导入Maven项目,编译时候出错,好象是接不上apache.org/maven2,下载不了maven-resources-plugin-2.6.jar 这个jar包
出错内容:
Plain Text code
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
[INFO]?Scanning?for?projects...
[INFO]
[INFO]?------------------------------------------------------------------------
[INFO]?Building?maven-01?0.0.1-SNAPSHOT
[INFO]?------------------------------------------------------------------------
Downloading:?https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.pom
[INFO]?------------------------------------------------------------------------
[INFO]?BUILD?FAILURE
[INFO]?------------------------------------------------------------------------
[INFO]?Total?time:?1.234?s
[INFO]?Finished?at:?2014-09-05T09:57:26+08:00
[INFO]?Final?Memory:?2M/6M
[INFO]?------------------------------------------------------------------------
[ERROR]?Plugin?org.apache.maven.plugins:maven-resources-plugin:2.6?or?one?of?its?dependencies?could?not?be?resolved:?Failed?to?read?artifact?descriptor?for?org.apache.maven.plugins:maven-resources-plugin:jar:2.6:?Could?not?transfer?artifact?org.apache.maven.plugins:maven-resources-plugin:pom:2.6?from/to?central?(https://repo.maven.apache.org/maven2):?sun.security.validator.ValidatorException:?PKIX?path?building?failed:?sun.security.provider.certpath.SunCertPathBuilderException:?unable?to?find?valid?certification?path?to?requested?target?->?[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?articles:
[ERROR]?[Help?1]?http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
网上查了一下,无法访问maven.org网站的解决此问题理论上有两个办法,一个是在maven的配置文件中设置代理,另一个是在maven的配置文件中设置联通网络下,能够访问的中央仓库的mirrors。因为也不好找稳定的代理,在网上搜索了两个可用的mirror站点,配置方式如下:
1、打开maven配置文件(maven安装目录下的conf目录下的settings.xml文件)
2、搜索mirrors关键字,加入mirror镜像节点
ibiblio.org ibiblio Mirror of http://repo1.maven.org/maven2/ http://mirrors.ibiblio.org/pub/mirrors/maven2 central jboss-public-repository-group central JBoss Public Repository Group http://repository.jboss.org/nexus/content/groups/public但是这两个也不好用,在这里使用 OSC Maven 仓库找到开源中国的资源库,
配置了他们的镜像文章来源:https://www.toymoban.com/news/detail-549500.html
osc \* http://maven.oschina.net/content/groups/public/成功编译。文章来源地址https://www.toymoban.com/news/detail-549500.html
到了这里,关于maven中央仓库不能访问的解决办法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!