Install Gradle in Windows 11 environment

Comparison between Gradle and maven

Maven
classic is easy to use, and the convention is greater than the configuration, making it easy to get started, but the flexibility is slightly less.
Using xml configuration to manage dependencies looks a little ugly.
On large projects, re-doing all the steps for every build can take a long time.
Gradle
is a more modern build tool, but the learning cost is higher.
Built using scripting, the syntax is concise and more flexible.
Compilation speed is fast and suitable for large projects.
Gradle can not only build Java language, but also other languages.
You can use Gradle to convert a maven project into a gradle project, so small projects can use maven first, and then convert to Gradle when the project is larger. For example, spring was first built using maven, but now Gradle is used to build the spring project. The construction has been completed in a few minutes instead of half an hour. If our project can be built within a few minutes, it would be more appropriate to use maven.

installation steps:

1. Download the installation package

Download address:
https://gradle.org/releases/
Insert image description here

2. After downloading, put it in your own computer disk path

After downloading, unzip it to the local directory you want to install. Note that the installation directory should not contain special characters such as Chinese and spaces.
Insert image description here

3. Configure environment variables

Create a new GRADLE_HOMEenvironment variable and fill in the value of the gradle directory you just installed, as follows:

Insert image description here
Then add the option value, , in the PATH environment variable %GRADLE_HOME%\bin, as follows:

Insert image description here

Dependency package download configuration

Next, configure the environment variables. Note that Gradle depends on JDK, so you also need to install JDK. Create a new GRADLE_USER_HOMEenvironment variable and fill in the value as the local directory where you want to store the downloaded dependency packages, as follows:

Insert image description here

verify

Finally, open the CMD command line window and enter gradle -vfor verification.

Insert image description here

Did you think it was over? Not yet

Configure mirror source

  1. Create a new file in the gradle init.d path
D:\maven\gradle-7.5.1\init.d

Insert image description here

document content:

allprojects {
    
    
    repositories {
    
     
        mavenLocal() 
        maven {
    
     name "Alibaba" ; url "https://maven.aliyun.com/repository/public" } 
        maven {
    
     name "Bstek" ; url "https://nexus.bsdn.org/content/groups/public/" } 
        mavenCentral()
    }
    buildscript {
    
    
        repositories {
    
     
            maven {
    
     name "Alibaba" ; url 'https://maven.aliyun.com/repository/public' } 
            maven {
    
     name "Bstek" ; url 'https://nexus.bsdn.org/content/groups/public/' } 
            maven {
    
     name "M2" ; url 'https://plugins.gradle.org/m2/' }
        }
    }
}

At this point the installation is basically complete. If you have anything to add, please feel free to enlighten me, thank you all! ! !

Guess you like

Origin blog.csdn.net/hai411741962/article/details/132896471