The installation and configuration of grdle corresponds to the version of gradle and jdk

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

Gradle official website

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-ZUbUZRoF-1690249867587)(../notes/picture backup/1690248244728.png)]

After the download is complete, unzip it

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-f7DV7vJC-1690249867588)(../notes/picture backup/1690248636533.png)]

Environment configuration

Configure environment variables, create a new environment variable named GRADLE_HOME whose value is your Gradle installation (decompression) path

insert image description here
[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-3QJerwZm-1690249867588)(../notes/picture backup/1690248770482.png)]

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

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-MyZwQISx-1690249867589)(../notes/picture backup/1690248880922.png)]

Open the console and enter gradle -v

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-5ZeSPHxX-1690249867589)(../notes/picture backup/1690248976851.png)]

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

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-Uq0UM4Sw-1690249867590)(../notes/picture backup/1690249067724.png)]

Configure the global warehouse address in the environment variable, and add an environment variable named GRADLE_USER whose value is your Gradle warehouse path.

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-J37AqGgj-1690249867590)(../notes/picture backup/1690249270467.png)]

Configure remote warehouse mirroring

init.dTake 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

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-QTJaixWB-1690249867590)(../notes/picture backup/1690249393370.png)]

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.

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-hHgOoUJv-1690249867590)(../notes/picture backup/1690249768279.png)]

Guess you like

Origin blog.csdn.net/Qhx20040819/article/details/131911031