Installing manually

Step 1. Download the latest Gradle distribution

The current Gradle release is version 8.2.1, released on 10 Jul 2023. The distribution zip file comes in two flavors:

Download and Extract to disk, then add to path so that you can use gradle init

E:\work\myGradle>gradle init

Select type of project to generate:
1: basic
2: application
3: library
4: Gradle plugin
Enter selection (default: basic) [1..4] 1

Select build script DSL:
1: Kotlin
2: Groovy
Enter selection (default: Kotlin) [1..2] 2

Project name (default: myGradle): gradle-tutorial
Generate build using new APIs and behavior (some features may change in the next minor release)? (default: no) [yes, no]

Task :init
To learn more about Gradle by exploring our Samples at https://docs.gradle.org/8.2.1/samples

BUILD SUCCESSFUL in 54s
2 actionable tasks: 2 executed

Open folder with vsCode to view files…

Java files go in: src/main/java/com/earnhardt

Java Test files go in: src/test/java/com/earnhardt

Update the build.gradle to add ‘Plugins’ , ‘jar-manifest’, ‘repositories’, and ‘dependencies’

Create the main program file:

src/main/java/com/earnhardt/GradleTutorial.java
package com.earnhardt;

public class GradleTutorial {
    public static void main(String[] args) {
        System.out.println("Gradle 4tw!");
    }
}

Create the test program file:

src/test/java/com/earnhardt/GradleTutorialTest.java
package com.earnhardt;

import org.junit.Test;

public class GradleTutorialTest {
    @Test
    public void verifyNoExceptionThrown() {
        GradleTutorial.main(new String[]{});
    }
}

Notice, after ‘gradle init’ has been run, you use gradlew going forward….

Once built, test results are stored in build/reports/test/com.earnhardt.html

java -jar build\libs\gradle-tutorial.jar