Learn Gradle

Flexible, incremental build tool for JVM, Android and Kotlin projects

14 lessons · 3 hours · 4 levels · covers Gradle 9.x (8.x notes where relevant)

Gradle is the build automation tool behind most Java, Kotlin and Android projects. Build scripts written in Kotlin or Groovy declare plugins, dependencies and tasks, and Gradle runs only what changed, with caching and parallelism. Knowing it lets you build, test and publish JVM software and fix the build problems every team hits.

How deep do you want to go?

1. EssentialsRead and write simple code, do the everyday basics4 lessons · 36 min in total
2. PracticalUse it productively at work, with the usual idioms8 lessons · 1 hour in total
3. AdvancedThe less common features, performance and trade-offs11 lessons · 2 hours in total
4. ExpertInternals and the edge cases experts know14 lessons · 3 hours in total

The Gradle tree

GradleThe wrapper and the command lineThe wrapper and thecommand lineBuild scripts and settingsBuild scripts andsettingsDeclaring dependenciesDeclaringdependenciesRunning testsRunning testsTasks, dependencies and lifecycleTasks, dependenciesand lifecyclePlugins and conventionsPlugins andconventionsVersion catalogsVersion catalogsMulti-project buildsMulti-project builds
Essentials and Practical shown (8 of 14 lessons); the full list is below. Click a lesson to read it.

All 14 lessons, in order

Getting started

  1. The wrapper and the command line · Essentials · 8 min

    Run builds with the Gradle wrapper (gradlew), understand the standard lifecycle tasks and common flags.

  2. Build scripts and settings · Essentials · 10 min

    Read a build.gradle.kts and settings.gradle.kts: plugins, repositories, dependencies and the project layout.

  3. Running tests · Essentials · 8 min

    Configure the test task for JUnit 5, filter tests, see output and reports, and fail fast.

Dependencies and plugins

  1. Declaring dependencies · Essentials · 10 min

    Add libraries with implementation, api, compileOnly, runtimeOnly and test configurations, and inspect the resolved graph.

  2. Plugins and conventions · Practical · 10 min

    Apply core and community plugins with the plugins block, pin versions, and understand what conventions they add.

  3. Version catalogs · Practical · 10 min

    Centralize dependency and plugin versions in gradle/libs.versions.toml and use type-safe libs accessors.

  4. Resolution, conflicts and BOMs · Advanced · 12 min

    Control transitive versions with platforms, strict versions, exclusions, substitutions and dependency locking.

Tasks and builds

  1. Tasks, dependencies and lifecycle · Practical · 12 min

    Register custom tasks, wire dependsOn, understand configuration vs execution phases and task types like Copy and Exec.

  2. Publishing artifacts · Advanced · 10 min

    Publish libraries to Maven repositories with maven-publish, including POM metadata, sources and signing.

Multi-project and performance

  1. Multi-project builds · Practical · 12 min

    Split a build into subprojects, share configuration with convention plugins, and depend on sibling projects.

  2. Incremental builds and the build cache · Advanced · 12 min

    Understand up-to-date checks, task inputs/outputs, the local and remote build cache, and the configuration cache.

  3. Writing plugins and lazy configuration · Expert · 15 min

    Build reusable binary plugins with extensions, Property and Provider types, and typed tasks that follow Gradle's lazy APIs.

  4. Build performance tuning · Expert · 12 min

    Profile builds with scans and --profile, tune daemon memory, parallelism, configuration cache and remote caching.

  5. Variants, attributes and capabilities · Expert · 14 min

    Understand variant-aware resolution: how attributes pick jars vs classes, JVM versions and feature variants, and how to debug it.