开发避坑指南(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仓库地址"
    }
}
相关推荐
澈如冬雪^2 天前
IDEA导入已经下载的jar包
pycharm·intellij-idea·jar
2601_962189602 天前
【SpringBoot】使用IDEA创建SpringBoot项目
java·spring boot·intellij-idea
卓怡学长3 天前
w175基于springboot校园二手物品交易平台
java·spring boot·spring·maven·intellij-idea
2601_962122973 天前
解决 IntelliJ IDEA 中 Tomcat 日志乱码问题的详细指南
java·tomcat·intellij-idea
demon75520033 天前
IDEA-http-client-指南
http·intellij-idea
xcs194054 天前
新版 IDEA(尤其是 2024/2025/2026)越来越臃肿
前端·人工智能·intellij-idea
XS0301065 天前
【无标题】
java·tomcat·maven·intellij-idea
典典分享指南5 天前
飞书 + 企业微信 + 微信文档多端协同实践指南
汇编·flask·intellij-idea·fastapi
:-)5 天前
idea中的vue文件没有高亮显示
前端·javascript·vue.js·ecmascript·intellij-idea
典典分享指南5 天前
Windows 自动化踩坑实录
python·intellij-idea·pyqt·emacs·visual studio