开发避坑指南(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仓库地址"
    }
}
相关推荐
JAVA面经实录9171 天前
IDEA 开发知识
java·intellij-idea·idea
guo_wen_qiang1 天前
springboot如何自定义一个启动器starter
java·spring boot·intellij-idea
松树戈2 天前
idea查找实体字段调用情况Find Usages找不到Value write(字段赋值的地方)解决措施
intellij-idea
滕州市燕猫虎计算机科技工作室个体工商户3 天前
IDEA:Command line is too long
java·ide·intellij-idea
golang学习记3 天前
不用再装RestfulKit!IDEA原生快捷键一键检索后端接口
intellij-idea
譕痕5 天前
notepad++安装插件 可视化展示 json串内容
json·intellij-idea
初学者↑5 天前
MCP调试JetBrains 插件,像调接口一样调 MCP
pycharm·intellij-idea·idea插件·mcp
横木沉5 天前
IntelliJ IDEA 无法识别 Git:Git is not installed 问题解决
java·git·github·intellij-idea
不灭的黄金瞳1235 天前
Java数据类型与变量
java·开发语言·intellij-idea
jaysee-sjc5 天前
【苍穹外卖】Day01:从零认识企业级项目开发
java·开发语言·数据库·mysql·spring·intellij-idea·mybatis