java - Maven:无法读取工件描述符错误
问题描述
我克隆了一个 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 中打开它时,可以在我的浏览器中访问 repo“https://repo.maven.apache.org/maven2”。
经过一番谷歌搜索,我在 .m2 文件夹中放置了一个 settings.xml 文件,如下所示
<?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 中手动添加和为什么我仍然收到骆驼的错误?谢谢
解决方案
PKIX 路径构建失败:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效证书路径
几乎可以肯定您系统上的根 CA 证书已过时。尝试更新您的 JDK 安装。请注意,您的浏览器使用的 CA 证书可能与 JRE/JDK 使用的不同。
如果不了解有关系统的更多详细信息,就很难提供更准确的答案。
这个答案提供了可能的解决方法。
推荐阅读
- docker - 不支持将 Docker Compose 迁移到 Kubernetes Volume Mount
- zfs - 多个磁盘上的 ZFS 数据同时损坏
- android - com.google.firebase.database.DatabaseException:无法将 java.lang.String 类型的对象转换为 com.example.noalumni.model.Users 类型
- visual-studio-code - VS Code - 查找快捷方式“when”表达式的面板/视图上下文名称
- python - 从 Azure Databricks 删除 SQL 数据库中的表
- php - PHP - 直接在字符串中提取函数结果
- django - Django ORM 从查询集中提取工作日作为字符串
- reactjs - 在React中的n数组中的x项上渲染父元素?
- react-redux - 如何开玩笑测试在componentDidMount中有api调用的连接组件
- android - 我们可以从 Android 中的 Google Drive API 检索数据吗?