gradle Using insecure protocols with repositories, without explicit opt-in, is unsupported.
时间: 2023-09-28 09:08:31 浏览: 44
Gradle 在使用不安全的协议(如 HTTP)与仓库进行通信时,需要明确地进行允许。否则,Gradle 不支持使用不安全的协议。
解决这个问题的方法有几种。其中一种是在Gradle配置中添加`allowInsecureProtocol(true)`,以允许使用不安全的协议。例如,在`allprojects`代码块中添加以下配置:
```groovy
allprojects {
repositories {
maven {
allowInsecureProtocol(true)
url "http://artifactory.xxx"
}
}
}
```
另一种方法是使用Gradle 8.0及以上的版本,在build.gradle文件中使用Kotlin DSL的`allowInsecureProtocol`关键字来设置允许使用不安全的协议。例如:
```kotlin
plugins {
id 'org.springframework.boot' version '2.5.2'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
repositories {
allowInsecureProtocol = true
// 其他仓库配置
}
// 其他配置和依赖项
```
请注意,使用不安全的协议可能存在安全风险,请确保你理解并接受这些风险。<span class="em">1</span><span class="em">2</span><span class="em">3</span>