maven下载不了仓库地址为https的依赖jar,配置参数忽略ssl安全检查

问题原因

私服使用的https地址,然后安全证书过期的或没有,使用maven命令时,可以添加以下参数,忽略安全检查

sh 复制代码
mvn -Dmaven.wagon.http.ssl.insecure=true -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.http.ssl.ignore.validity.dates=true

参数详解

  • Dmaven.wagon.http.ssl.insecure=true - 允许放松ssl安全检查;
  • Dmaven.wagon.http.ssl.allowall=true - 允许所有的X.509格式证书匹配,如果修改为false,则会执行和浏览器一致的检查;
  • Dmaven.wagon.http.ssl.ignore.validity.dates=true - 忽略证书过期的问题

idea配置默认参数

在idea中配置VM选项,然后就可以默认使用这些参数

maven配置setting,使其忽略安全检查

xml 复制代码
<proxies>
    <proxy>
          <id>my-proxy</id>
          <active>true</active>
          <protocol>http</protocol>
          <host>my-proxy-host</host>
          <port>my-proxy-port</port>
          <nonProxyHosts>localhost|127.0.0.1</nonProxyHosts>
          <!-- 添加以下三个参数 -->
          <sslHostConfig>
           	<!--指定是否信任所有证书-->
              <all>true</all>
               <!--指定使用的SSL协议版本-->
              <sslProtocol>all</sslProtocol>
               <!--指定是否启用SSL-->
              <sslEnabled>true</sslEnabled>
               <!--指定支持的SSL协议版本列表-->
              <sslProtocols>TLSv1.2</sslProtocols>
              <!--指定是否忽略证书验证-->
              <ignoreCertificates>true</ignoreCertificates>
              <!-- 指定是否信任自签名证书-->
              <trustSelfSigned>true</trustSelfSigned>
              <!-- 指定是否允许所有证书  -->
              <allowAllCerts>true</allowAllCerts>
          </sslHostConfig>
      </proxy>
 </proxies>
相关推荐
爱琴孩2 小时前
Maven聚合、继承与私库详解
maven·继承·私库·聚合
LiLiYuan.2 小时前
【怎么理解maven中的镜像和仓库?】
maven
wheelmouse77885 小时前
Maven构建配置学习笔记
笔记·学习·maven
清蒸鳜鱼5 小时前
腾讯云域名配置HTTPS完整指南:从0到1部署Flask应用
https·flask·腾讯云
teamlet5 小时前
多域名TLS 证书的自动签名和续期
golang·https·letsencrypt·acmev2
计算机毕设指导61 天前
基于微信小程序的积分制零食自选平台【源码文末联系】
java·spring boot·mysql·微信小程序·小程序·tomcat·maven
lx188548698961 天前
HTTPS总结
服务器·网络协议·https
2501_915106321 天前
App HTTPS 抓包实战解析,从代理调试到真实网络流量观察的完整抓包思路
网络协议·http·ios·小程序·https·uni-app·iphone
游戏开发爱好者81 天前
苹果App Store应用程序上架方式全面指南
android·小程序·https·uni-app·iphone·webview
2501_916008891 天前
深入理解 iPhone 文件管理,从沙盒结构到开发调试的多工具协同实践
android·ios·小程序·https·uni-app·iphone·webview