我克隆了一个JAVA存储库,当我尝试使用“ mvn install”构建它时,出现以下错误
Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.3.2.RELEASE from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/org/springframework/boot/spring-boot-starter-parent/2.3.2.RELEASE/spring-boot-starter-parent-2.3.2.RELEASE.pom and 'parent.relativePath' points at no local POM @ line 6, column 13: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 2]
当我在Chrome中打开存储库“ https://repo.maven.apache.org/maven2”时,可以在我的浏览器中对其进行访问。
经过一番搜索,我将settings.xml文件放在.m2文件夹中,如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>securecentral</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>securecentral</id>
<!--Override the repository (and pluginRepository) "central" from the
Maven Super POM -->
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
现在,当我运行“ mvn install”时,spring-boot的错误消失了。但是我现在正面临这个错误:
Failed to read artifact descriptor for org.apache.camel.springboot:camel-salesforce-starter:jar:3.4.2: Could not transfer artifact io.dropwizard.metrics:metrics-bom:pom:4.1.9 from/to central (https://repo.maven.apache.org/maven2): Transfer failed for https://repo.maven.apache.org/maven2/io/dropwizard/metrics/metrics-bom/4.1.9/metrics-bom-4.1.9.pom: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]
我的问题是,为什么我需要手动添加并在settings.xml中,为什么我仍然遇到骆驼错误?谢谢
答案 0 :(得分:1)
PKIX路径构建失败: sun.security.provider.certpath.SunCertPathBuilderException:无法 找到到所请求目标的有效认证路径
几乎可以肯定,系统上的根CA证书已过时。 尝试更新您的JDK安装。请注意,您的浏览器使用的CA证书可能与JRE / JDK使用的证书不同。
在不了解有关系统的更多详细信息的情况下,很难提供更准确的答案。
This answer提供了可能的解决方法。
答案 1 :(得分:0)
您可以尝试运行mvn -U clean install
-U
是
强制检查丢失的版本和远程上更新的快照 仓库
或尝试删除本地存储库文件夹。有时在出现网络问题时会变得混乱... 您可以在.m2文件夹中找到本地回购文件夹(在Windows上:C:\ Users <您的用户名> .m2)
您可以删除整个存储库文件夹或其中的一部分。之后,只需运行mvn clean install
答案 2 :(得分:0)