zoukankan      html  css  js  c++  java
  • gradle配置国内镜像

    对单个项目生效,在项目中的build.gradle修改内容

    buildscript {
      repositories {
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
      }
      dependencies {
        classpath 'com.android.tools.build:gradle:2.2.1'
      } 
    }
    
    allprojects {
      repositories {
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'http://maven.aliyun.com/nexus/content/repositories/jcenter'}
      }
    }

    对所有项目生效,在.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
        }
      }
    }
  • 相关阅读:
    网络传输介质和布线
    计算机网络参考模型
    c语言中利用函数库获取当前时间,写入文件中。
    明解c语言 13-4
    c语言中fprintf函数,向文件中写入数据
    c语言 13
    c语言中统计文件字符数
    c语言中使用fscanf函数从文件读取数据(逐行读取并保存变量)
    繁华模拟赛 ljw搭积木
    繁华模拟赛 找十字架
  • 原文地址:https://www.cnblogs.com/lkc9/p/10562857.html
Copyright © 2011-2022 走看看