maven下载依赖失败:PKIX path building failed

错误信息:

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 

 

  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

maven下载依赖失败:PKIX path building failed_第1张图片

你可能感兴趣的:(maven)