gpt4 book ai didi

java - 无法在错误的本地 POM 中找到到请求目标的有效证书路径和 'parent.relativePath' 点

转载 作者:行者123 更新时间:2023-12-05 06:21:48 25 4
gpt4 key购买 nike

我正在尝试使用 maven Spring 库并遵循 this 为 java (eclipse) 中的微服务构建概念证明教程。

下面是我的 POM 文件,它显示了一个我无法解决的错误:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.tutorials</groupId>
<artifactId>HelloWorld</artifactId>
<version>0.0.1-SNAPSHOT</version>


<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.0.RELEASE</version>
</parent>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

</project>

在标签上<parent>我有以下错误:

Project build error: Non-resolvable parent POM for com.tutorials:HelloWorld:0.0.1-SNAPSHOT: Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:
1.2.0.RELEASE from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has
elapsed or updates are forced. Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:1.2.0.RELEASE 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 and 'parent.relativePath' points at wrong local POM

我该如何解决这个问题?谢谢。

编辑: 在 User/.m2 目录下,我创建了一个 settings.xml 文件来克服代理问题,如下所示:

<settings>
<proxies>
<proxy>
<id>example-proxy</id>
<active>true</active>
<protocol>http</protocol>
<host>proxy.example.com</host>
<port>8080</port>
<nonProxyHosts>www.google.com|*.example.com</nonProxyHosts>
</proxy>
</proxies>
</settings>

现在报错如下:

Project build error: Non-resolvable parent POM for com.tutorials:HelloWorld:0.0.1-SNAPSHOT: Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:
2.2.2.RELEASE from https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has
elapsed or updates are forced. Original error: Could not transfer artifact org.springframework.boot:spring-boot-starter-parent:pom:2.2.2.RELEASE from/to central (https://
repo.maven.apache.org/maven2): proxy.example.com and 'parent.relativePath' points at wrong local POM

最佳答案

问题是您的 java 安全性中未安装证书。正如您所提到的,您能够访问 https://repo.maven.apache.org/maven2/如果您使用的是 chrome,则需要从站点信息中导出证书。

之后需要在Keystore中安装证书,在这种情况下

java 8 : jdk->jre->lib->security

java 11 : jdk->lib->security

安装证书的命令:

keytool -import -noprompt -trustcacerts -alias -file -keystore -storepass

这个问题已在 2 年多前提出,但希望有人能从中得到帮助。

关于java - 无法在错误的本地 POM 中找到到请求目标的有效证书路径和 'parent.relativePath' 点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59598487/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com