错误信息
> Failed to execute goal
> org.springframework.boot:spring-boot-maven-plugin:2.1.4.RELEASE:repackage
> (default) on project mds-all-frontier: Execution default o f goal
> org.springframework.boot:spring-boot-maven-plugin:2.1.4.RELEASE:repackage
> failed:Plugin org.springframework.boot:spring-boot-maven-plugin:
> 2.1.4.RELEASE or one of its dependencies could not be resolved:Failed to collect dependencies at
> org.springframework.boot:spring-boot-maven-plugin:jar:2.1.4.RELEASE ->
> org.springf ramework.boot:
> spring-boot-loader-tools:jar:2.1.4.RELEASE:Failed to read artifact
> descriptor for
> org.springframework.boot:spring-boot-loader-tools:jar:2.1.4.RELEAS
> E:Could not transfer artifact
> org.springframework.boot:spring-boot-loader-tools:pom:2.1.4.RELEASE
> from/to central (https://repo.maven.apache.org/maven2):sun.secu
> rity.validator.ValidatorException:PKIX path building
> failed:sun.security.provider.certpath.SunCertPathBuilderException:unable
> to find valid certification path t o requested target
两种解决方案:
1. 证书加入
将https://repo.maven.apache.org/maven2/
和https://maven.aliyun.com/nexus/content/groups/public/
证书加入$JAVA_HOME\jre\lib\security\cacerts中 (部分有效)
keytool -import -alias maven.aliyun.com -keystore ./cacerts -file code.cer -trustcacerts -storepass changeit
keytool -import -alias repo.maven.com -keystore ./cacerts -file repo.cer -trustcacerts -storepass changeit
导入证书
切换到jre的/lib/security/下:
1.将JDK安装在D盘
2.使用管理员权限打开命令行
更新证书时,先删除原来的证书,然后导入新的证书
keytool -list -keystore cacerts
keytool -delete -alias akazam_email -keystore cacerts
keytool -import -alias akazam_email -file akazam_email.cer -keystore cacerts -trustcacerts
2. mvn下载依赖忽略SSL证书认证
-Dmaven.multiModuleProjectDirectory=$MAVEN_HOME
-Dmaven.wagon.http.ssl.insecure=true
-Dmaven.wagon.http.ssl.allowall=true
-Dmaven.wagon.http.ssl.ignore.validity.dates=true
-DarchetypeCatalog=internal
-Dmaven.multiModuleProjectDirectory=$MAVEN_HOME
-Dmaven.wagon.http.ssl.insecure=true
-Dmaven.wagon.http.ssl.allowall=true
-Dmaven.wagon.http.ssl.ignore.validity.dates=true
作用相同:maven.wagon.http.ssl.insecure=true