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>
相关推荐
lwf0061644 小时前
Maven Wrapper 使用指南
maven
2501_915921434 小时前
穿越HTTPS迷雾:Wireshark中的TLS抓包秘诀与文件合并方法
网络协议·ios·小程序·https·uni-app·wireshark·iphone
PinTrust SSL证书5 小时前
Sectigo(Comodo)企业型OV通配符SSL
网络·网络协议·网络安全·小程序·https·ssl
我登哥MVP6 小时前
【SpringMVC笔记】 - 9 - 异常处理器
java·spring boot·spring·servlet·tomcat·maven
lclcooky7 小时前
Nginx代理到https地址忽略证书验证配置
运维·nginx·https
MeAT ITEM8 小时前
maven导入spring框架
数据库·spring·maven
chenxu98b8 小时前
SpringBoot Maven 项目 pom 中的 plugin 插件用法整理
spring boot·后端·maven
acaad8 小时前
java访问https连接报错 unable to find valid certification path to requested target
网络协议·http·https
fy1216310 小时前
Spring Boot spring-boot-maven-plugin 参数配置详解
spring boot·后端·maven
CXH7281 天前
nginx——https
运维·nginx·https