6.x.修改gradle仓库构建
IDEA版本及gradle构建设置
在gradle指定仓库地址/wrapper/dists/找到与gradle wrapper相对应的gradle版本,在gradle的init.d/目录下新建init.gradle文件,内容如下:
allprojects{repositories {mavenLocal()maven { url 'https://maven.aliyun.com/repository/public/' }maven { url 'https://maven.aliyun.com/repository/jcenter/' }maven { url 'https://maven.aliyun.com/repository/google/' }maven { url 'http://私库地址/repository/gradle-distribution/'allowInsecureProtocol = true}maven { url 'https://jitpack.io/' }}
}
settingsEvaluated { settings ->settings.pluginManagement {repositories.clear()repositories {mavenLocal()maven {url 'http://私库地址/repository/gradle-distribution/'allowInsecureProtocol = true}}}
}
错误1
Exception is:
org.gradle.api.plugins.UnknownPluginException: Plugin [id: ‘io.spring.nohttp’, version: ‘0.0.11’] was not found in any of the following sources:
allprojects{repositories {mavenLocal()maven { url 'https://maven.aliyun.com/repository/public/' }maven { url 'https://maven.aliyun.com/repository/jcenter/' }maven { url 'https://maven.aliyun.com/repository/google/' }maven { url 'http://私库地址/repository/gradle-distribution/'allowInsecureProtocol = true}maven { url 'https://jitpack.io/' }}
}
settingsEvaluated { settings ->settings.pluginManagement {repositories.clear()repositories {mavenLocal()maven {url 'http://私库地址/repository/gradle-distribution/'allowInsecureProtocol = true}}}
}
解决方式:maven仓库地址修改
allprojects{repositories {mavenLocal()maven { url 'https://maven.aliyun.com/repository/public/' }maven { url 'https://maven.aliyun.com/repository/jcenter/' }maven { url 'https://maven.aliyun.com/repository/google/' }maven { url 'https://maven.aliyun.com/repository/gradle-plugin/'}maven { url 'https://jitpack.io/' }}
}
settingsEvaluated { settings ->settings.pluginManagement {repositories.clear()repositories {mavenLocal()maven {url 'https://maven.aliyun.com/repository/gradle-plugin/'}}}
}
问题1
gradle本地仓库已经下载了上面nohttp-0.0.11.jar依赖的jar包,再更换上面代理仓库地址时,还是会提示相关依赖找不到。
构建完成之后,将init.gradle配置文件修改之前报错的,提示如下: