可以添加或者更新阿里仓库镜像:

阿里云云效 Maven:https://developer.aliyun.com/mvn/guide

1. settings.gradle 版本

pluginManagement {

repositories {

maven {

url 'https://maven.aliyun.com/repository/central'

allowInsecureProtocol = true

}

maven {

url 'https://maven.aliyun.com/repository/public'

allowInsecureProtocol = true

}

maven {

url 'https://maven.aliyun.com/repository/gradle-plugin'

allowInsecureProtocol = true

}

maven {

url 'https://maven.aliyun.com/repository/apache-snapshots'

allowInsecureProtocol = true

}

google()

mavenCentral()

gradlePluginPortal()

maven {

url 'https://www.jitpack.io'

}

}

}

2. settings.gradle.kts 版本

pluginManagement {

repositories {

maven(url = "https://maven.aliyun.com/repository/central") {

isAllowInsecureProtocol = true

}

maven(url = "https://maven.aliyun.com/repository/public") {

isAllowInsecureProtocol = true

}

maven(url = "https://maven.aliyun.com/repository/gradle-plugin") {

isAllowInsecureProtocol = true

}

maven(url = "https://maven.aliyun.com/repository/apache-snapshots") {

isAllowInsecureProtocol = true

}

google()

mavenCentral()

gradlePluginPortal()

maven(url = "https://www.jitpack.io")

}

}

代码表示在Gradle构建中添加了一个名为maven的Maven仓库。通过url属性指定了仓库的URL地址为https://maven.aliyun.com/repository/…,即阿里云的Maven仓库。

allowInsecureProtocol属性被设置为true,表示允许使用不安全的协议进行下载,例如使用HTTP而不是HTTPS。

推荐阅读

评论可见,请评论后查看内容,谢谢!!!评论后请刷新页面。