Gradle DSL Groovy Vs Kotlin

I have read a lot of blogs that says Gradle is getting more inclined towards Kotlin than Groovy. In one of the videos I heard that Gradle is progressing very fast towards its integration with Kotlin.

But when I read the userguide for latest gradle release it says “At the heart of Gradle lies a rich extensible Domain Specific Language (DSL) based on Groovy.” (Gradle 4.4.1)

Will it always be groovy? Or in some upcoming release this will too move to Kotlin?

That section is outdated and being redone for the next release.

The answer is both. Groovy and Kotlin are available in the current release, but Groovy was the first DSL and the user guide/docs are written around it. The Kotlin DSL is pretty far along and getting the docs/examples to show both Groovy and Kotlin are something we want to do.

And what would be the recommended starting language new adopers should watch at today?

As far as i could follow the discussions the main advantage for kotlin is the easier IDE integration, which is a strong point even more for new users as they are not that used to the DSL. On the other hand it seems kotlin does not have full support for each and every thing?

My opinion would be to stick with Groovy if you’re a Gradle beginner. Mostly because all of the documentation examples are Groovy, as well as almost anything you’ll find on the web.

1 Like

Using the Kotlin DSL works very well in IntelliJ IDEA, for obvious reasons. I am finding a few “gotchas” transforming working Groovy DSL scripts to Kotlin DSL scripts, but once in place the Kotlin DSL works very well. I took a policy decision that all Kotlin applications with Gradle builds should use the Kotlin DSL and have not regretted it. I think using the Kotlin DSL for Java codes is also a good idea especially if there is a plan to integrate Kotlin code, or even transform the Java to Kotlin. For Groovy codes, maybe stick with Groovy DSL.

1 Like