Switch Maven repository 'maven(http://maven.aliyun.com/nexus/content/repositories/central/)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols.

分析:
Gradle 7.0 版本构建项目以上就会出现这个问题
bashUsing insecure protocols with repositories, without explicit opt-in, is unsupported. Switch Maven repository 'maven(XXX)' to redirect to a secure protocol (like HTTPS) or allow insecure protocols
大致意思是maven仓库的配置需要使用HTTPS的方式
gradle为了安全考虑,默认禁用使用非官方的中央仓库(如阿里云),若使用需显示声明信任它。
解决方法:
方法1:
将仓库的http换成https
方法2
在仓库前添加关键字:allowInsecureProtocol = true
如,项目的build.gradle 或者 settings.gradle 文件里面加入
pluginManagement {
repositories {
maven {
allowInsecureProtocol true
url 'maven地址'
}
}
}
dependencyResolutionManagement {
repositories {
maven {
allowInsecureProtocol true
url '你的maven地址'
}
}
}
le.li
浙公网安备 33010602011771号