maven仓库
每一个项目都会在根项目下的build.gradle里面去依赖maven仓库,当我们网络差的情况下,或者某些国外的仓库的时候,会导致我们下载的速度极度缓慢,如何去解决这个问题,便是我们接下来讲诉的事情.
maven仓库转换
- 如何进行maven仓库转换,其实就是把国内的镜像文件进行替换
- 常见的国内镜像
- 阿里云maven仓库
- 网易163maven仓库
- 其他maven仓库
转换之前仓库
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
//gradle 2.0 gradle uploadArchives
System.properties['com.android.build.gradle.overrideVersionCheck'] = 'true'
repositories {
google()
maven {
url 'http://repo1.maven.org/maven2'
}
jcenter {
url "http://jcenter.bintray.com/"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven {
url 'http://repo1.maven.org/maven2'
}
jcenter {
url "http://jcenter.bintray.com/"
}
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
转换之后仓库
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
//gradle 2.0 gradle uploadArchives
System.properties['com.android.build.gradle.overrideVersionCheck'] = 'true'
repositories {
maven {
url "https://maven.aliyun.com/repository/google"
}
maven {
url "https://maven.aliyun.com/repository/jcenter"
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
maven {
url "https://maven.aliyun.com/repository/google"
}
maven {
url "https://maven.aliyun.com/repository/jcenter"
}
maven { url 'https://jitpack.io' }
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}
maven仓库参考资料
https://www.cnblogs.com/gne-hwz/p/9664408.html
结束语
至此便可以加快maven下载速度