前言
今天创建一个新的项目,结果发现kotlin的配置死活就没办法下载,这时候想到要去配置镜像,结果发现gradle7配置变得不一样了。。这里记录一下,gradle7配置镜像的问题
配置
我们选用aliyun镜像,首先打开setting.gradle
,在pluginManagement->repositories
和dependencyResolutionManagement->repositories
下添加相应代理
pluginManagement {
repositories {
maven {
url 'https://maven.aliyun.com/repository/public'
}
maven {
url "https://maven.aliyun.com/repository/google"
}
maven { url "https://jitpack.io" }
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
maven {
url 'https://maven.aliyun.com/repository/public'
}
maven {
url "https://maven.aliyun.com/repository/google"
}
maven { url "https://jitpack.io" }
google()
mavenCentral()
}
}
rootProject.name = "KotlinApp"
include ':app'
点击sync
之后便可以等待下载了。这里贴一下所有的代理镜像,大家按需添加即可
https://developer.aliyun.com/mvn/guide
问题
Gradle7
下使用http
私库时,提示要使用 https
, 可以使用 allowInsecureProtocol true
关闭。
repositories {
google()
mavenCentral()
maven {
allowInsecureProtocol = true
url 'http://xxxxxx/xxxxxx/xxxxxx'
}
}
网友评论