开发避坑指南(66):IDEA 2025 Gradle构建安全协议警告:Maven仓库HTTPS切换或允许HTTP的配置方法

报错信息

java 复制代码
A problem occurred configuring root project 'order-service'.
> Could not resolve all dependencies for configuration 'classpath'.
   > Using insecure protocols with repositories, without explicit opt-in, is unsupported.

* Try:
> Switch Maven repository 'maven(xxx)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols.

错误分析

Gradle 7.0 版本构建项目以上就会出现这个问题,Gradle从高版本开始默认禁止使用不安全的HTTP协议访问Maven仓库所致。

解决办法

1、将仓库访问地址由http修改为https。

2、修改build.gradle配置,显式允许不安全协议。

groovy 复制代码
repositories {
    maven {
        allowInsecureProtocol = true
        url "maven仓库地址"
    }
}
相关推荐
潲爺13 小时前
Java IDEA学习之路:第九周课程笔记归纳
java·学习·intellij-idea
爱分享的Shawn_Salt17 小时前
IntelliJ IDEA初始化指南
java·ide·intellij-idea
摇滚侠19 小时前
idea 刷新maven,提示java.lang.RuntimeException: java.lang.OutOfMemoryError
java·maven·intellij-idea
那我掉的头发算什么1 天前
【javaEE】多线程——线程安全初阶☆☆☆
java·jvm·安全·java-ee·intellij-idea
蜡笔大新7981 天前
IDEA中的异常
java·ide·intellij-idea
仟濹1 天前
IntelliJ IDEA 快捷键 + 实时模板
java·intellij-idea
无糖冰可乐211 天前
IDEA多java版本切换
java·ide·intellij-idea
合作小小程序员小小店1 天前
web开发,在线%超市销售%管理系统,基于idea,html,jsp,java,ssh,sql server数据库。
java·前端·sqlserver·ssh·intellij-idea
brucelee1861 天前
IntelliJ IDEA 设置 Local History 永久保留
java·ide·intellij-idea
百***07182 天前
IDEA+Docker一键部署项目SpringBoot项目
spring boot·docker·intellij-idea