对新项目clean install 的时候,报错了,提示没有合法的证书,报错信息如下
[ERROR] Failed to execute goal on project springbootactivity: Could not resolve dependencies for project com.example:springbootactivity:jar:0.0.1-SNAPSHOT: Failed to collect dependencies at org.springframework.boot:spring-boot-starter-test:jar:2.4.1: Failed to read artifact descriptor for org.springframework.boot:spring-boot-starter-test:jar:2.4.1: Could not transfer artifact org.springframework.boot:spring-boot-starter-test:pom:2.4.1 from/to alimaven (http://maven.aliyun.com/nexus/content/groups/public/): sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target -> [Help 1]
打开Idea,File->Settings->Maven->Runner,在VM Options中填入如下配置即可
-Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true
再次clean install,就可以BUILD SUCCESS
PS
这里唯一的缺点就是每新建一个项目都要这样设置一次,暂时这样先用着吧,后面再彻底解决。