内容简介:Gradle 也可以用下面的方式声明使用的插件:其实是从 Gradle 官方的插件仓库但是,众所周知的原因,某些地区会连不上,导致下载不到需要的插件,例如出现如下错误:
Gradle 也可以用下面的方式声明使用的插件:
// build.gradle
plugins {
id 'com.example.plugin', version '1.0'
}
其实是从 Gradle 官方的插件仓库 https://plugins.gradle.org/m2/ 下载的。
但是,众所周知的原因,某些地区会连不上,导致下载不到需要的插件,例如出现如下错误:
* What went wrong:
A problem occurred configuring root project 'MyApp'.
> Could not resolve all files for configuration ':classpath'.
> Could not download jimfs.jar (com.google.jimfs:jimfs:1.1)
> Could not get resource 'https://plugins.gradle.org/m2/com/google/jimfs/jimfs/1.1/jimfs-1.1.jar'.
> Could not HEAD 'https://plugins.gradle.org/m2/com/google/jimfs/jimfs/1.1/jimfs-1.1.jar'.
> Connect to d29vzk4ow07wi7.cloudfront.net:443 [d29vzk4ow07wi7.cloudfront.net/54.192.84.6, d29vzk4ow07wi7.cloudfront.net/54.192.84.168, d29vzk4ow07wi7.cloudfront.net/54.192.84.128, d29vzk4ow07wi7.cloudfront.net/54.192.84.173] failed: Read timed out
又或者,插件是不对外的,存在某个私有仓库的,该如何修改或者添加额外的私有仓库地址呢?
直接修改 settings.gradle
来添加其它仓库:
// settings.gradle
pluginManagement {
repositories {
maven {
url 'http://examle.com/maven-repo'
}
gradlePluginPortal()
}
}
当然你也可以使用老的方式应用插件:
buildscript {
repositories {
maven {
url 'http://examle.com/maven-repo'
}
}
dependencies {
classpath 'com.example.plugin:gradle-plugin:1.0'
}
}
apply plugin: 'com.example.plugin'
references:
以上所述就是小编给大家介绍的《修改 Gradle 插件(Plugins)的下载地址(repositories)》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:- Vue 分页插件 v-page v2.0.0 发布,重构并修改参数设置方式
- 不修改模板的前提下修改VisualState中的某些值
- 修改Git已提交的的Author和EMail(批量修改脚本)
- ViewGroup 默认顺序绘制子 View,如何修改?什么场景需要修改绘制顺序?
- Per.js 史上最大修改版本,2.1 版本更新,修改 5 项功能
- 通过修改环境变量修改当前进程使用的系统 Temp 文件夹的路径
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Machine Learning in Action
Peter Harrington / Manning Publications / 2012-4-19 / GBP 29.99
It's been said that data is the new "dirt"—the raw material from which and on which you build the structures of the modern world. And like dirt, data can seem like a limitless, undifferentiated mass. ......一起来看看 《Machine Learning in Action》 这本书的介绍吧!