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>
相关推荐
2501_915921437 小时前
iOS应用耗电测试:使用Energy Log、Keymob和Instruments进行性能监控与能源消耗分析
android·ios·小程序·https·uni-app·iphone·webview
可信时间戳10 小时前
原创作品怎么申请版权?草稿、定稿、已发布、已授权,四个阶段四个做法
网络协议·http·https
VX_bysjlw98510 小时前
基于协同过滤的美食推荐系统的设计与实现32221-计算机毕设原创(免费领源码+带部署教程)
java·spring boot·redis·mysql·tomcat·maven·mybatis
Lsetea16 小时前
OpenSSL的checkhost显示不匹配却退出0:名称检查与证书验收
linux·https·shell·ssl证书·openssl
不像程序员的程序媛1 天前
maven基础
python·pycharm·maven
万年咸鱼1 天前
HTTPS 是如何保证传输安全的?
网络协议·安全·https
2501_915909061 天前
抓包工具断点拦截是什么?如何半路拦截修改 HTTP 请求
网络协议·计算机网络·网络安全·adb·https·udp
幸福清风1 天前
从域名到一行 nginx 配置:一次站点 HTTPS 证书更换与排障复盘
python·nginx·https
半摆烂日常2 天前
手机表单的左滑操作:触摸事件的处理细节
大数据·开发语言·人工智能·智能手机·https·c#