maven訪問私有倉庫,不信任 SSL 證書問題解決

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)

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>
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容