Course map
Stage 1: Foundation
Stage 2: Intermediate
Stage 3: Advanced
Stage 4: DSA in Java
Stage 5: Specialization

Part 15 / Topic 6 of 7

Gradle, conceptually

Gradle is not installed on this machine (../../TOOLING.md) — nothing in this section was run or verified here, by design. This is the one part of this lesson covered conceptually only: enough to recognize a Gradle project and read its build file, not a verified transcript.

Gradle solves the same problem Maven does (dependencies, compile, test, package, as one repeatable command), with a different build file and a different underlying model:

Maven Gradle
Build file pom.xml (XML) build.gradle.kts (Kotlin DSL) or build.gradle (Groovy)
Model fixed lifecycle phases (section 3) a graph of tasks, each declaring what it depends on
Dependency scopes compile, test, ... implementation, testImplementation, ... (similar idea, different names)
Typical invocation mvn package ./gradlew build (the wrapper script, so no local Gradle install is even required on a real project)

An illustrative (not executed) build.gradle.kts, for the same shape of project as examples/maven-project/:

plugins {
    application
}
repositories { mavenCentral() }
dependencies {
    testImplementation("org.junit.jupiter:junit-jupiter:5.14.5")
}
java {
    sourceCompatibility = JavaVersion.VERSION_21
}
application { mainClass = "com.acme.billsplit.BillSplitter" }

The shape is recognizable even without running it: repositories and dependencies do the same job as Maven's <dependencies>; the application plugin's mainClass is Gradle's answer to Maven's <mainClass> manifest configuration (section 3); ./gradlew build runs the Gradle equivalent of mvn package.

⚠️ Nothing in this section is a verified claim. If this course later installs Gradle and genuinely runs it, that transcript belongs in an update to this section with real output — not here. Until then, treat this table as orientation for reading someone else's Gradle project, not as tested fact.

Done here? The practice set for Part 15 — including the solutions — is on the part page.

Search the guide