Maven 配置https的仓库地址时,需要在jdk中导入证书

Maven 配置https的仓库地址时,需要在jdk中导入证书

一、背景

在使用maven搭建CAS服务的时候,pom中配置了一个https的仓库地址,但是从该仓库下载依赖包的时候无法成功下载。日志报错。这是没有安全证书造成的。

maven PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException:
 unable to find valid certification path
 

二、证书管理

一、查看证书库中的证书列表

cd %JAVA_HOME%\jre\lib\security
keytool -list -V  -keystore cacerts -storepass changeit

命名解释:

-keystore cacerts 选择证书库 cacerts。注意在%JAVA_HOME%\jre\lib\security目录,所以可以直接用cacerts。

-storepass changeit 设置证书库需要密码 changeit为默认密码

二、导入证书

keytool -keystore cacerts -importcert -alias nexussecureca -file D:/https-shibboleth.net-nexus.cer -storepass changeit

命名解释:-alias nexussecureca 设置导入证书的别名为nexussecureca

​ -file xxxxx 设置导入证书的文件路径

三、删除证书

keytool -delete -alias nexussecureca -keystore  cacerts -storepass changeit
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章