问题描述
在Eclipse中创建Maven项目,或者使用Maven从特定的远程仓库下载jar包时 ,得到下面的错误信息:
Failure to transfer org.apache.maven.archetypes:maven-archetype-quickstart:pom:1.1 from … was cached in the local repository, resolution will not be reattempted until the update interval of … has elapsed or updates are forced. Original error: Could not transfer artifact org.apache.maven.archetypes:maven-archetype-quickstart:pom:1.1 from/to …: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
原因分析
用户配置文件settings.xml中设置了远程仓库,但是没有设置代理,导致连接远程仓库时,找不到对应的有效证书,认为是不可信站点,于是抛出这个错误信息。
解决方法
目的让JRE信任这个证书,把该远程仓库地址的证书导入到JRE的证书库中。
- 在浏览器上访问远程仓库地址,然后通过浏览器将证书导出。步骤如下&#x