Gradle Kotlin DSL 1.0

Posted on by



This is a guest blog post from Paul Merlin

software engineer for Gradle

The recently released Gradle 5.0 includes the Gradle Kotlin DSL v1.0 which is now ready for widespread use.

We want you to enjoy a build authoring experience with the benefits provided by Kotlin’s static type system in Intellij IDEA and Android Studio: auto-completion, smart content assist, quick access to documentation, navigation to source and context-aware refactoring.

https://gradle.org/images/hello-kotlin-2.webm To view the video in Safari you may need to install the VLC Web Browser Plugin.

In case you missed it, you can watch Paul Merlin demonstrate these benefits in the Type-safe build logic with Gradle Kotlin DSL video from KotlinConf 2018.

If you prefer the flexibility and dynamic features of Groovy, that’s totally okay — the Groovy DSL will not be deprecated.

Using the Kotlin DSL today

You can get started quickly by following the Creating New Gradle Builds guide. You can also follow one of the other guides like Building Kotlin JVM Libraries or Building Java Applications.

The Gradle Kotlin DSL Primer user manual chapter is the best place to start learning more: it will cover all the basics and answer most of your questions.

If you are working with an existing build using the Gradle Groovy DSL you’ll be interested in the Migrating build logic from Groovy to Kotlin guide.

Several community plugins now have Gradle Kotlin DSL snippets in their documentation: Spring Boot, Docker, Detekt, Kotlinter, APT, Android JUnit 5, Android Check 2, Android Play Publisher and the list goes on.

Last but not least, the Gradle documentation contains build script excerpts that demonstrate both the Groovy DSL and the Kotlin DSL. This is the best place to find how to all things with each DSL; and it covers all Gradle features.

Again, a big thank you to all who helped make this a reality!

Feedback wanted

Community involvement has been instrumental to reach 1.0. It is also crucial going forward.