开发避坑指南(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仓库地址"
    }
}
相关推荐
摇滚侠9 小时前
IDEA 创建 Java 项目 手动整合 SSM 框架
java·ide·intellij-idea
摇滚侠14 小时前
SpringMVC 入门到实战 RESTFul 49-55
java·开发语言·后端·spring·intellij-idea·restful
代码雕刻家16 小时前
1.24.MySQL-idea中连接MySQL的基本操作
数据库·mysql·intellij-idea
星月IWJ17 小时前
idea 工具整理
java·spring boot·intellij-idea
终将老去的穷苦程序员17 小时前
IntelliJ IDEA 的安装教程
java·ide·intellij-idea
承渊政道18 小时前
飞算JavaAI 智能引导背后的多 Agent 协作机制解析:从老旧 Java 后台升级到可运行工程
java·开发语言·spring boot·安全·intellij-idea·软件工程·ai编程
lazy H2 天前
Spring Boot 项目如何连接 Redis?新手入门配置和常见错误总结
ide·spring boot·redis·后端·学习·intellij-idea
二哈赛车手2 天前
新人笔记---idea索引失效问题解决方案
java·笔记·spring·elasticsearch·intellij-idea
潇凝子潇2 天前
IDEA插件
java·ide·intellij-idea
lazy H2 天前
Maven 依赖爆红怎么办?IDEA 中 Maven 项目常见问题和解决方法总结
java·后端·学习·maven·intellij-idea