开发避坑指南(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仓库地址"
    }
}
相关推荐
lifewange14 小时前
Pycharm和IDEA中安装Cursor的方法
ide·pycharm·intellij-idea
misL NITL1 天前
idea、mybatis报错Property ‘sqlSessionFactory‘ or ‘sqlSessionTemplate‘ are required
tomcat·intellij-idea·mybatis
lifewange2 天前
Claude Code可以安装在IDEA和Pycharm中么
java·pycharm·intellij-idea
lifewange2 天前
OpenCode可以安装在IDEA和Pycharm中么
java·pycharm·intellij-idea
千码君20162 天前
flutter:构建失败的原因总结
android·flutter·gradle·模拟器·dependencies·emulator
空中海2 天前
第 3 章:Gradle 进阶工程能力
gradle
空中海2 天前
第 2 章:Gradle 项目构建实战
gradle
梁萌2 天前
idea报错找不到XX包的解决方法
java·intellij-idea·启动报错·缺少包
空中海3 天前
第 1 章:Gradle 入门基础
gradle
EvenBoy3 天前
IDEA中使用CodeX
java·ide·intellij-idea