下載安裝不用介紹。
安裝完成后設置系統變量path為bin,新建系統變量GRADLE_USER_HOME值為gradle安裝的目錄,或者自己隨便找一個目錄都行。
在這個目錄下新建文件init.gradle,內容如下:
allprojects{ repositories { def REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public/' all { ArtifactRepository repo -> def url = repo.url.toString() if ((repo instanceof MavenArtifactRepository) && (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 } } }
之后的jar包下載就會使用阿里雲倉庫,本地庫為GRADLE_USER_HOME\caches\modules-2\files-2.1