The version relationship between java and gradle
Java
Java Gradle requires a Java version between 8 and 19. Java 20 and higher are not currently supported.
Java 6 and Java 7 can still be used for compilation, but are no longer suitable for testing. Gradle 9.0 does not support testing for Java 6 and Java 7. Any fully supported Java version can be used for compilation or testing.
However, the latest Java versions may only support compiling or testing, but not running Gradle yet.
For older Gradle versions, see the table below, which Gradle version supports which Java version. Table 1.
Java compatibility Java version First Gradle version supports it 8 2.0 9 4.3 10 4.7 11 5.0 12 5.4 13 6.0 14 6.3 15 6.7 16 7.0 17 7.3 18 7.5 19 7.6 20 8.1⚠
Java version | First Gradle version to support it |
---|---|
8 | 2.0 |
9 | 4.3 |
10 | 4.7 |
11 | 5.0 |
12 | 5.4 |
13 | 6.0 |
14 | 6.3 |
15 | 6.7 |
16 | 7.0 |
17 | 7.3 |
18 | 7.5 |
19 | 7.6 |
20 | 8.1 ⚠ |
Gradle installation
I installed version 6.3
After the download is complete, unzip it
Environment configuration
Configure environment variables, create a new environment variable named GRADLE_HOME whose value is your Gradle installation (decompression) path
Then add %GRADLE_HOME%\bin to the Path environment variable, note that it needs to be separated from the previous variable ;
, and then click OK
Open the console and enter gradle -v
Configure the gradle warehouse address
In the gradle decompression directory, create a new repository directory
It is recommended to put it in the same directory, so that it will be easy to find when migrating in the future
Configure the global warehouse address in the environment variable, and add an environment variable named GRADLE_USER whose value is your Gradle warehouse path.
Configure remote warehouse mirroring
init.d
Take Alibaba Cloud as an example, configure the remote warehouse image, create a new file in the folder in gradle init.gradle
, and add the following configuration to the file
allprojects {
repositories {
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/' }
}
}
}
Configure Gradle in IDEA
Enter Gradle directly in the search box, and click Apply after the configuration is complete.