安装

官方安装教程:https://gradle.org/install/

macOS

  1. brew install gradle

安装指定版本的

  1. brew info gradle@6
  2. gradle@6 is keg-only, which means it was not symlinked into /usr/local,
  3. because this is an alternate version of another formula.
  4. If you need to have gradle@6 first in your PATH, run:
  5. echo 'export PATH="/usr/local/opt/gradle@6/bin:$PATH"' >> ~/.zshrc
  6. source ~/.zshrc

阿里云

https://help.aliyun.com/document_detail/102512.html

代理的仓库列表

仓库名称 代理源地址 使用地址
central https://repo1.maven.org/maven2/ https://maven.aliyun.com/repository/central
https://maven.aliyun.com/nexus/content/repositories/central
jcenter http://jcenter.bintray.com/ https://maven.aliyun.com/repository/jcenter
https://maven.aliyun.com/nexus/content/repositories/jcenter
public central仓和jcenter仓的聚合仓 https://maven.aliyun.com/repository/public
https://maven.aliyun.com/nexus/content/groups/public
google https://maven.google.com/ https://maven.aliyun.com/repository/google
https://maven.aliyun.com/nexus/content/repositories/google
gradle-plugin https://plugins.gradle.org/m2/ https://maven.aliyun.com/repository/gradle-plugin
https://maven.aliyun.com/nexus/content/repositories/gradle-plugin
spring http://repo.spring.io/libs-milestone/ https://maven.aliyun.com/repository/spring
https://maven.aliyun.com/nexus/content/repositories/spring
spring-plugin http://repo.spring.io/plugins-release/ https://maven.aliyun.com/repository/spring-plugin
https://maven.aliyun.com/nexus/content/repositories/spring-plugin
grails-core https://repo.grails.org/grails/core https://maven.aliyun.com/repository/grails-core
https://maven.aliyun.com/nexus/content/repositories/grails-core
apache snapshots https://repository.apache.org/snapshots/ https://maven.aliyun.com/repository/apache-snapshots
https://maven.aliyun.com/nexus/content/repositories/apache-snapshots

gradle配置指南

在build.gradle文件中加入以下代码:

  1. allprojects {
  2. repositories {
  3. maven { url 'https://maven.aliyun.com/repository/public/' }
  4. mavenLocal()
  5. mavenCentral()
  6. }
  7. }