1 問題表現(xiàn)
1.1 拉取jar包失敗
1.2 報錯信息示例
PKIX path building failed 說明是HTTPS 證書校驗(yàn)失敗
Caused by: The following artifacts could not be resolved: com.center:center-jar-api:pom:2.0.0 (absent):
Could not transfer artifact com.center:center-jar-api:pom:2.0.0 from/to dict-repo (https://192.168.71.1:10181/repository/maven-public/):
PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
1.3 問題確認(rèn)
- 直接使用瀏覽器訪問倉庫https://192.168.71.1:10181/repository/maven-public/
-
第一次訪問的話,瀏覽器會有告警提示
image.png
2 本地解決方案
其它解決方案,例如倒入證書等,過程復(fù)雜且容易失敗,修改setting文件是我目前找到的最簡單的方式
2.1 修改maven的setting.xml文件
注意標(biāo)簽是否已經(jīng)在文件中存在,如果存在請放在合適的標(biāo)簽下
<settings>
<profiles>
<profile>
<id>allow-insecure</id>
<properties>
<maven.wagon.http.ssl.insecure>true</maven.wagon.http.ssl.insecure>
<maven.wagon.http.ssl.allowall>true</maven.wagon.http.ssl.allowall>
</properties>
</profile>
</profiles>
<activeProfiles>
<activeProfile>allow-insecure</activeProfile>
</activeProfiles>
</settings>
