[POLL] Which DSL do you prefer? Groovy vs Kotlin

I have always used Gradle with Groovy DSL.
I have up until now considered Kotlin a second class citizen.

After reading this I started thinking I should give Kotlin a chance.

Gradle’s Kotlin DSL provides an alternative syntax to the traditional Groovy DSL with an enhanced editing experience in supported IDEs, with superior content assistance, refactoring, documentation, and more.

What DSL do you prefer to use with Gradle?
If possible, reply why you think Groovy or Kotlin is better.

  • Groovy
  • Kotlin

0 voters

Imho it is not a 2nd class citizen, but the better alternative.

With the Kotlin DSL you have type-safe build scripts.
Due to that the IDE support (at least when using a good IDE like IntelliJ) is far superior.
Also the error messages are much better with the Kotlin DSL if you write something wrong as you immediately get a compile error, and not just a sometimes cryptic runtime error due to the duck-typing in Groovy.
And with the Kotlin DSL there is also no need at all anymore for the -all distribution which has exactly one use-case, that is while editing build scripts in Groovy DSL, while it just wastes time, bandwith, and disc space for everyone and everthing just executing a build.

Sometimes if you have a really old plugin that does not get updated, you might run into problems if the plugin is highly coupled to the Groovy DSL specifics.
But any recent / maintained plugin should properly support usage in Kotlin DSL or otherwise should be fixed.
But even then there are ways to mitigate the problem from using withGroovyBuilder { ... } to using a Groovy DSL script plugin.

1 Like