开发避坑指南(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仓库地址"
    }
}
相关推荐
方白羽5 小时前
Android 开发中常见的编译加速方案
android·app·gradle
小毛球.7 天前
第 3 篇:IDEA 最新版下载与完整安装教程(Mac)
java·macos·intellij-idea·idea
张紫娃7 天前
idea 如何看一个类的 .class 文件
java·ide·intellij-idea
开开心心就好8 天前
两张表格数据对比工具,不用写函数也能查
算法·spring·智能手机·pdf·电脑·intellij-idea·音视频
薛之谦_10 天前
Java 全栈知识体系:从 IDEA 高效开发到 JVM、并发与 Stream 实战
java·jvm·intellij-idea
科小怪14 天前
IntelliJ IDEA 下载安装:写 Java 和 Kotlin 主流的开发工具
intellij-idea·软件推荐·下载教程
若亦_17 天前
Java中关于this的三种用法
java·开发语言·intellij-idea
奶油话梅糖19 天前
打开项目 0.9 秒、内存只有 IDEA 的 1/12:OpenIDEA 用 Rust 把 IntelliJ IDEA 重造了一遍
java·rust·github·intellij-idea
golang学习记19 天前
IDEA 2026.3 远程开发迎来重磅升级
java·ide·intellij-idea·远程开发
code2cat21 天前
Java工具篇之Gradle:用任务图组织构建与交付
java·开发语言·单元测试·gradle