gradle 安装配置

1,下载gradle

http://services.gradle.org/distributions/

2,设置gradle下载jar的位置:GRADLE_USER_HOME

这里将其放到d盘

3,配置init.gradle

路径

C:\Users\Administrator\.gradle

内容

allprojects{
  repositories {
    def REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public/'
      all { ArtifactRepository repo ->
        if(repo instanceof MavenArtifactRepository){
          def url = repo.url.toString()
          if (url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('https://jcenter.bintray.com/')) {
            project.logger.lifecycle "Repository ${repo.url} replaced by $REPOSITORY_URL."
            remove repo
          }
       }
    }
    maven {
      url REPOSITORY_URL
    }
  }
}

4,设置下载仓库地址

init.gradle 的设置如下

allprojects {
    repositories {
         maven {
             name "aliyunmaven"
             url "http://maven.aliyun.com/nexus/content/groups/public/"
         }
	}
}

猜你喜欢

转载自my.oschina.net/u/3574106/blog/2245320