记录贴:maven和gradle配置阿里云镜像

阿里云镜像教程: https://maven.aliyun.com/mvn/guide
在根目录下build.gradle中两个repositories标签下增加maven { url ''}

// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    ext.kotlin_version = '1.3.72'
    repositories {
        maven {
            url 'https://maven.aliyun.com/repository/central'
        }
        ...
    }
    dependencies {
        classpath "com.android.tools.build:gradle:4.1.1"
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // 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/central'
        }
        ...
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

ext {
    ...
}

仓库jcenter()可以使用以下代替:

    maven {
        url 'https://maven.aliyun.com/repository/public'
    }
posted @ 2021-03-12 00:22  笪笠  阅读(309)  评论(0编辑  收藏  举报