IntelliJ的Maven编译返回找不到有效证书

小结

将IntelliJ工程拷贝到新的机器中,返回Maven编译返回找不到有效证书的问题,进行了解决。

问题及解决

找不到有效证书

将IntelliJ工程拷贝到新的机器中,返回Maven编译返回找不到有效证书的问题,具体报错如下:

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

首先下载证书, 点这个锁,并点击’Connection is Secure’:

在这里插入图片描述

点这个证书:

Cert
点"Detail"并对相应的证书进行下载:

Cert detail
下载后通过以下指令对证书进行导入(以下显示先前已经导入过了):

C:\Users\John Xiong\.jdks\temurin-11.0.21\bin>keytool -import -alias Maven -keystore "C:\Users\John Xiong\.jdks\temurin-11.0.21\lib\security\cacerts" -file "C:\Users\John Xiong\Downloads\repo.maven.apache.org.crt" -storepass changeit
Warning: use -cacerts option to access cacerts keystore
Certificate already exists in keystore under alias <maven2>
Do you still want to add it? [no]:  No
Certificate was not added to keystore

C:\Users\John Xiong\.jdks\temurin-11.0.21\bin>

至此,Maven编译返回找不到有效证书的问题已经解决。

++++++++++++++++++++++++++++++++分割线+++++++++++++++++++++++++++

以下是尝试过的办法,并没有解决问题:
在VM Options添加-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true,忽略证书,问题依旧。

VM Options

在Server Certificate下添加证书也是不行。
Add certificate

找不到org.springframework.stereotype.Service

添加以下:

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
        </dependency>

问题IntelliJ: Cannot resolve symbol ‘springframework’

这个问题是Maven同步有问题,点以下更新按钮:

在这里插入图片描述

参考

CSDN: 使用IDEA配置SpringBoot项目报错Failure to transfer org.springframework.boot:spring-boot-starter-parent:pom:2
Maven repository: Spring Boot Starter Test » 2.7.8
https://repo.maven.apache.org/maven2/
stackoverflow: Proxy Setting Issue with Maven update
stackoverflow:Spring tool suite- SunCertPathBuilderException: unable to find valid certification path to requested target
stackoverflow:How do I find the library containing org.springframework.stereotype.Service?  
stackoverflow: IntelliJ: Cannot resolve symbol ‘springframework’

  • 21
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值