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>
相关推荐
00后程序员张5 小时前
从审核被拒到稳定过审,iOS 上架技术优化
android·ios·小程序·https·uni-app·iphone·webview
福运常在16 小时前
股票数据API(19)次新股池数据
java·python·maven
回到原点的码农18 小时前
maven导入spring框架
数据库·spring·maven
人机与认知实验室18 小时前
Maven与以色列福音系统有何区别?
java·maven
亿牛云爬虫专家19 小时前
爬虫踩坑实录:OkHttp 接入爬虫代理报 Too many tunnel connections attempted 深度解析
爬虫·okhttp·https·爬虫代理·connect·隧道代理·ip 切换
zl_dfq21 小时前
计算机网络 之 【https协议】(数字摘要、密钥、数字证书)
网络协议·计算机网络·https
※DX3906※21 小时前
SpringBoot之旅4: MyBatis 操作数据库(进阶) 动态SQL+MyBatis-Plus实战,从入门到熟练,再也不踩绑定异常、SQL拼接坑
java·数据库·spring boot·spring·java-ee·maven·mybatis
帅得不敢出门1 天前
Android Framework中调用由java编译成的jar接口
android·java·framework·jar
Meepo_haha1 天前
Maven Spring框架依赖包
java·spring·maven
想进大厂的小徐2 天前
maven的子模块和子pom的区别
java·maven