• android studio更换成阿里源


    参考:https://www.cnblogs.com/qianmaoliugou/p/12369654.html

    1.android studio更换成阿里源

    在根目录中的bulid.gradle更改内容

    buildscript {
        repositories {
            maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
            maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
            maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
            maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
    //        google()
    //        mavenCentral()
        }
        dependencies {
            classpath "com.android.tools.build:gradle:4.2.1"
    
            // NOTE: Do not place your application dependencies here; they belong
            // in the individual module build.gradle files
        }
    }
    
    allprojects {
        repositories {
            maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
            maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter' }
            maven { url 'http://maven.aliyun.com/nexus/content/repositories/google' }
            maven { url 'http://maven.aliyun.com/nexus/content/repositories/gradle-plugin' }
    //        google()
    //        mavenCentral()
    //        jcenter() // Warning: this repository is going to shut down soon
        }
    }
    

    2.对所有项目都生效

    在用户/.gradle/下创建init.gradle文件

    allprojects{
        repositories {
            def ALIYUN_REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public'
            def ALIYUN_JCENTER_URL = 'http://maven.aliyun.com/nexus/content/repositories/jcenter'
            all { ArtifactRepository repo ->
                if(repo instanceof MavenArtifactRepository){
                    def url = repo.url.toString()
                    if (url.startsWith('https://repo1.maven.org/maven2')) {
                        project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."
                        remove repo
                    }
                    if (url.startsWith('https://jcenter.bintray.com/')) {
                        project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."
                        remove repo
                    }
                }
            }
            maven {
                    url ALIYUN_REPOSITORY_URL
                url ALIYUN_JCENTER_URL
            }
        }
    }
    
  • 相关阅读:
    Struts2框架(二)
    Struts2框架(一)
    jsp定义全局的错误处理
    BeanUtils的使用、Java中的路径问题
    IntelliJ IDEA 14.1.4(Window)快捷键
    Log4J日志组件
    注解
    反射
    泛型
    AndroidStudio开发工具快捷键(转)
  • 原文地址:https://www.cnblogs.com/lightice/p/14779984.html
Copyright © 2020-2023  润新知