Migrating to Kotlin Gradle DSL and using version catalogs
In Chapter 1, one of the advantages of using Kotlin that we listed is that we can also write our Gradle files in Kotlin. In this section, we will look at how we can migrate our Gradle files to Kotlin Gradle DSL. We will also look at how we can use a version catalog to manage our dependencies.
Before we migrate, let’s see some of the benefits we get from using Kotlin Gradle DSL:
- Code autocompletion: We get hints about the completion of our code in Gradle files as we are using Kotlin.
- Type safety: We get compile time errors when we make mistakes in our Gradle files.
- Function calls and variable assignments: We can use functions and variables in our Gradle files the same way we use them in our Kotlin code. It makes it even easier for us to write and understand.
- Compile time errors: We get errors at compile time when we make mistakes in our Gradle files. This helps us avoid runtime errors when building...