Old

Gradle is an example of dependency based programming: you define tasks and dependencies between tasks. Gradle guarantees that these tasks execute in the order of their dependencies.

Build commands

Default build

./gradlew build

Build without tests

./gradlew build -x test

Reference

Simple Gradle build script

This dependency is used by the application. Define the main class for the application.

plugins {
    // Apply the application plugin to add support for building a CLI application in Java.
    application 
}

repositories {
    // Use Maven Central for resolving dependencies.
    mavenCentral() 
}

dependencies {
    // Use JUnit Jupiter for testing.
    testImplementation("org.junit.jupiter:junit-jupiter:5.9.1") 

    // 	This dependency is used by the application.
    implementation("com.google.guava:guava:31.1-jre") 
}

application {
    // Define the main class for the application.
    mainClass.set("demo.App") 
}

tasks.named<Test>("test") {
    useJUnitPlatform() 
}

reference


Backlinks