下载gradle
官网:Gradle
环境变量
GRADLE_HOME:gradle路径
GRADLE_USER_HOME:自定义gradle本地仓库目录
Path:%GRADLE_HOME%\bin
注意:gradle也可以使用maven的本地仓库,只需要将GRADLE_USER_HOME设置为你的maven的本地仓库地址即可
测试
打开Windows powershell输入gradle -v
出现以下内容即为成功;
C:\Users\hy>gradle -v
Welcome to Gradle 7.4.2!
Here are the highlights of this release:
- Aggregated test and JaCoCo reports
- Marking additional test source directories as tests in IntelliJ
- Support for Adoptium JDKs in Java toolchains
For more details see https://docs.gradle.org/7.4.2/release-notes.html
------------------------------------------------------------
Gradle 7.4.2
------------------------------------------------------------
Build time: 2022-03-31 15:25:29 UTC
Revision: 540473b8118064efcc264694cbcaa4b677f61041
Kotlin: 1.5.31
Groovy: 3.0.9
Ant: Apache Ant(TM) version 1.10.11 compiled on July 10 2021
JVM: 1.8.0_212 (Oracle Corporation 25.212-b10)
OS: Windows 10 10.0 amd64
gradle阿里云配置
- 在gradle-7.4.2\init.d目录下创建
init.gradle
文件
allprojects {
repositories {
maven { url 'file:///C:/Java/maven_repository'}
mavenLocal()
maven { name "Alibaba" ; url "https://maven.aliyun.com/repository/public" }
maven { name "Bstek" ; url "http://nexus.bsdn.org/content/groups/public/" }
mavenCentral()
}
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/' }
}
}
}