Quantcast
Channel: IT瘾博客推荐
Viewing all articles
Browse latest Browse all 532

Gradle 修改 Maven 仓库地址(阿里镜像) - 芊鸟咔咔 - 博客园

$
0
0
buildscript {
    repositories {
        maven { url'http://maven.aliyun.com/nexus/content/groups/public/'}
        jcenter()
    }
    dependencies {
        classpath'com.android.tools.build:gradle:2.2.3'//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/'}
        jcenter()
    }
}      

转:https://my.oschina.net/ranvane/blog/820262

步骤一:进入GRADLE_USER_HOME
一般情况下是C:\Users\Administrator.gradle\这个目录,如果你还没有配置过,这个目录是不会变的,我们讲windows下,linux用户大同小异。
C:\Users\Administrator.gradle\

步骤二:新建一个init.gradle文件
该文件是每一个Gradle 项目执行之前的脚本文件

步骤三:文件中填入如下内容
allprojects {
    repositories {
        mavenLocal()
		maven { name "Alibaba" ; url "https://maven.aliyun.com/repository/public" }
		maven { name "Bstek" ; url "http://nexus.bsdn.org/content/groups/public/" }
    }
}
另外一个连插件都帮你配置好了

allprojects {
    repositories {
        mavenLocal()
		maven { name "Alibaba" ; url "https://maven.aliyun.com/repository/public" }
		maven { name "Bstek" ; url "http://nexus.bsdn.org/content/groups/public/" }
    }

	buildscript { 
		repositories { 
			maven { name "Alibaba" ; url 'https://maven.aliyun.com/repository/public' }
			maven { name "Bstek" ; url 'http://nexus.bsdn.org/content/groups/public/' }
			maven { name "M2" ; url 'https://plugins.gradle.org/m2/' }
		}
	}
}

Viewing all articles
Browse latest Browse all 532

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>