0Pricing
Kotlin Academy · Lesson

Custom Tasks

Automate work.

What is a Gradle Task?

A task is a unit of build work — compiling, copying files, running a tool. Custom tasks let you automate project-specific chores.

Registering a Task

Use tasks.register with the configuration-avoidance API. It is preferred over the older tasks.create because it is lazy.

tasks.register("hello") {
    doLast {
        println("Hello from Gradle")
    }
}

All lessons in this course

  1. Gradle Kotlin DSL
  2. Dependencies and Plugins
  3. Custom Tasks
  4. Version Catalogs
← Back to Kotlin Academy