Gradle builds with the Kotlin DSL

Implementing type-safe, developer-friendly automation code in Gradle


Gradle 5.0 introduces the Kotlin DSL as the primary language for implementing build scripts. This is great news for Gradle users and build logic authors alike. The Kotlin DSL provides type-safety as well as autocompletion, API discoverability and debuggability from the IDE.

Kotlin’s popularity has grown tremendously among the JVM community. If you are looking to use Kotlin for your build logic to get more productive, then this course is for you. In this hands-on training, you will learn how to set up a Gradle build with the Kotlin DSL from scratch. It also guides you through migration strategies to turn your Groovy-based build into a Kotlin-powered build. By the end of the course, you’ll understand the basics of the Kotlin programming language and know how to apply Gradle DSL best practices to develop your project automation code.


4 hours

What you’ll learn

  • The benefits of the Kotlin DSL
  • Kotlin programming language basics to help you make a connection to the DSL
  • The Gradle Kotlin DSL to implement complex build logic
  • How to migrate a Groovy DSL-based build to the Kotlin DSL


  • Working knowledge of the programming languages Java or Groovy
  • Familiarity with basic Gradle concepts and the Groovy DSL
  • An installation of IntelliJ community or professional edition


  • Benefits of using the Kotlin DSL
    • Shortcomings of the Groovy DSL
    • Type-safety & Null-safety
    • Improved IDE support
    • Performance aspects
  • Introduction to essential Kotlin language features
    • Language syntax compared to Java and Groovy
    • Types and properties
    • Creating classes and instantiating objects
    • Defining and calling functions
    • Creating and using collections
    • Using Lambdas
    • Hands-on exercise: Using Kotlin language features
  • The Kotlin DSL in practice
    • Kotlin build file conventions
    • Syntactic sugar added by the Kotlin DSL
    • Applying plugins
    • Configuring plugin tasks and extensions
    • Declaring repositories and dependencies
    • Hands-on exercise: Building a typical Java application
    • Creating and configuring ad-hoc and custom tasks
    • Hands-on exercise: Implementing custom build logic
    • Authoring multi-project builds
    • Organizing complex build logic
    • Hands-on exercise: Writing maintainable custom build logic
  • Migrating Groovy-based builds to the Kotlin DSL
    • Migration strategies
    • Precompiled script plugins vs. buildSrc
    • Interoperability with Groovy types and methods
    • Calling Groovy code and script plugins from Kotlin
    • Hands-on exercise: Migrating a build script from Groovy to Kotlin
  • Summary and Q&A

Ready? Let's talk!

We're here to help. If you'd like to learn more, get in touch with us.