开发避坑指南(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仓库地址"
    }
}
相关推荐
摇滚侠1 小时前
IDEA 定义返回值快捷键
java·ide·intellij-idea
A懿轩A1 小时前
【Maven 构建工具】从零到上手 Maven:安装配置 + IDEA 集成 + 第一个项目(保姆级教程)
java·maven·intellij-idea
_周游9 小时前
Java8 API 文档搜索引擎_2.索引模块(程序)
java·搜索引擎·intellij-idea
计算机毕设指导610 小时前
基于微信小程序的智能停车场管理系统【源码文末联系】
java·spring boot·微信小程序·小程序·tomcat·maven·intellij-idea
独自破碎E10 小时前
IDEA 提示“未配置SpringBoot配置注解处理器“的解决方案
java·spring boot·intellij-idea
_周游11 小时前
Java8 API 文档搜索引擎_2.索引模块(实现细节)
java·搜索引擎·intellij-idea
小旭95271 天前
Java 反射详解
java·开发语言·jvm·面试·intellij-idea
onkel in blog1 天前
【Java】Gradle 多模块项目实战:Spring Boot 微服务搭建全流程
java·spring boot·微服务·gradle
一只大马猴呀2 天前
IntelliJ IDEA 中启动项目不显示端口号
java·ide·intellij-idea
草履虫建模2 天前
A13 String 详解:不可变、常量池、equals 与 ==、性能与常见坑
java·开发语言·spring·jdk·intellij-idea·java基础·新手