开发避坑指南(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仓库地址"
    }
}
相关推荐
null_1719 小时前
IntelliJ IDEA 极致流畅配置方案:Ultra 9 285K + 64GB 内存实测
java·ide·intellij-idea
Tenifs1 天前
关闭 IDEA 的英文单词拼写检查
java·intellij-idea
唐青枫1 天前
Java Gradle 实战指南:从 Wrapper、Kotlin DSL 到 Spring Boot 多模块构建
java·kotlin·gradle
dyonggan1 天前
IDEA从零搭建SpringCloud Alibaba完整工程
java·spring cloud·intellij-idea
蜡台4 天前
通过Gradle脚本声明更改Java变量
android·java·开发语言·python·kotlin·gradle·groovy
浪客川4 天前
idea 技巧 region 的使用
java·ide·intellij-idea
Yolanda945 天前
【编程工具】关于IDEA的Mark Directory as操作的一点探索记录
java·ide·intellij-idea
大不点wow5 天前
为什么 Spring 更推荐构造器注入,而不是字段 `@Autowired`
java·spring·intellij-idea
独隅5 天前
IntelliJ IDEA 接入多种AI大模型插件全面指南(2026.1 版本)2
java·人工智能·intellij-idea
卓怡学长5 天前
w255基于springboot仓库管理系统
java·数据库·spring boot·spring·intellij-idea