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

**URL:** https://discuss.gradle.org/t/poll-which-dsl-do-you-prefer-groovy-vs-kotlin/44671
**Category:** Help/Discuss
**Created:** [January 16, 2023, 1:01pm UTC](https://discuss.gradle.org/t/poll-which-dsl-do-you-prefer-groovy-vs-kotlin/44671 "2023-01-16T13:01:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![DJViking](https://avatars.discourse-cdn.com/v4/letter/d/ecccb3/32.png) [@DJViking](https://discuss.gradle.org/u/DJViking)
#### Post date: [January 16, 2023, 1:01pm UTC](https://discuss.gradle.org/t/poll-which-dsl-do-you-prefer-groovy-vs-kotlin/44671/1 "2023-01-16T13:01:06Z")

</div>

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](https://docs.gradle.org/8.0-rc-1/userguide/kotlin_dsl.html) 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.

_Poll ([view on site](https://discuss.gradle.org/t/poll-which-dsl-do-you-prefer-groovy-vs-kotlin/44671/1))_

---

<div class="post-metadata">

### Author: ![Vampire](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/vampire/32/9082_2.png) [@Vampire](https://discuss.gradle.org/u/Vampire)
#### Post date: [January 16, 2023, 1:47pm UTC](https://discuss.gradle.org/t/poll-which-dsl-do-you-prefer-groovy-vs-kotlin/44671/2 "2023-01-16T13:47:12Z")

</div>

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.
