本文仅介绍在 Windows 系统下安装 Gradle 8.7。
下文使用winget作为包管理工具,因此按照本文档进行安装之前,确保本机上的winget能正常使用!!
使用
winget安装 Version Fox。1
winget install version-fox.vfox
查看
vfox版本:vfox -v,输出如下1
vfox version 0.3.0
如果你在安装的
vfox版本和本文的不一致,那么后续安装步骤可能不适用于你的vfox版本。使用
vfox安装 JDK21。添加
java插件:vfox add java,输出如下:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18Fetching plugin manifest...
Downloading https://github.com/version-fox/vfox-java/releases/download/v0.1.1/vfox-java-0.1.1.zip...
Validating C:\Users\Foobar\.version-fox\plugin\vfox-java-0.1.1.zip ...
Plugin info:
Name -> java
Version -> 0.1.1
Homepage -> https://github.com/version-fox/vfox-java
Desc -> Support for multiple JDK distributions, such as: Oracle, Graalvm, Eclipse & more.
Notes:
Listed below are the supported distributions and their short names.
- Oracle: x.y.z-oracle
- OpenJDK: x.y.z-open
- GraalVM: x.y.z-graal
- Temurin: x.y.z-tem
- Zulu: x.y.z-zulu
Others please see: https://github.com/version-fox/vfox-java
Add java plugin successfully!
Please use `vfox install java@<version>` to install the version you need.安装
java插件的 Temurin JDK21.0.2+13LTS 版本:vfox install java@v21.0.2+13-tem,输出如下:1
2
3
4
5
6
7Preinstalling java@21.0.2+13-tem...
Downloading... 100% [===============================================================================] (26 MB/s)
Verifying checksum ...
WARNING: Checksum is not provided, skip verify...
Unpacking C:\Users\Foobar\.version-fox\cache\java\OpenJDK21U-jdk_x64_windows_hotspot_21.0.2_13.zip...
Install java@21.0.2+13-tem success!
Please use vfox use java@21.0.2+13-tem to use it.应用
java@v21.0.2+13-tem:vfox use java@21.0.2+13-tem,输出如下:1
2Warning: The current shell lacks hook support or configuration. It has switched to global scope automatically.
Now using java@21.0.2+13-tem.验证
java是否安装成功:java -version,输出如下:1
2
3openjdk version "21.0.2" 2024-01-16 LTS
OpenJDK Runtime Environment Temurin-21.0.2+13 (build 21.0.2+13-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.2+13 (build 21.0.2+13-LTS, mixed mode, sharing)至此,Temurin JDK
21.0.2+13安装完毕。
使用
vfox安装 Gradle8.7。添加
gradle插件:vfox add gradle,输出如下:1
2
3
4
5
6
7
8
9Plugin info:
Name -> gradle
Version -> 0.1.1
Homepage -> https://github.com/version-fox/vfox-gradle
Desc -> Gradle runtime environment.
Notes:
The plugin supports specifying mirrors to download the installer.
Add gradle plugin successfully!
Please use `vfox install gradle@<version>` to install the version you need.安装
gradle版本:vfox install gradle@8.7,输出如下:1
2
3
4
5Downloading... 100% [===============================================================================] (26 MB/s)
Verifying checksum 544c35d6bd849ae8a5ed0bcea39ba677dc40f49df7d1835561582da2009b961d...
Unpacking C:\Users\Foobar\.version-fox\cache\gradle\gradle-8.7-bin.zip...
Install gradle@8.7 success!
Please use vfox use gradle@8.7 to use it.应用
gradle@8.7:vfox use gradle@8.7(vfox为多版本包管理工具,这一步是为了指定切换到需要使用的版本),输出如下:1
2
3Warning: The current shell lacks hook support or configuration. It has switched to global scope automatically.
Now using gradle@8.7.
Windows PowerShell验证
gradle是否安装成功:gradle -v1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22Welcome to Gradle 8.7!
Here are the highlights of this release:
- Compiling and testing with Java 22
- Cacheable Groovy script compilation
- New methods in lazy collection properties
For more details see https://docs.gradle.org/8.7/release-notes.html
------------------------------------------------------------
Gradle 8.7
------------------------------------------------------------
Build time: 2024-03-22 15:52:46 UTC
Revision: 650af14d7653aa949fce5e886e685efc9cf97c10
Kotlin: 1.9.22
Groovy: 3.0.17
Ant: Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM: 21.0.2 (Eclipse Adoptium 21.0.2+13-LTS)
OS: Windows 11 10.0 amd64