Gradle and Its New Kotlin DSL [Video]

DZone 's Guide to

Gradle and Its New Kotlin DSL [Video]

Interested in trying out Gradle's Kotlin DSL? Here is a simple screencast that depicts the advantages and disadvantages of using Kotlin with Gradle.

· Java Zone ·
Free Resource

A couple of months ago, the Gradle team decided that you can now also write your build.gradle files with Kotlin instead of Groovy. Although this whole effort is still in its infancy, it can turn out to be quite exciting. Why? 

Because with  Kotlin build.gradle.kts files, you get compile errors if you specify incorrect options. You get autocompletion. Basically, everything a statically typed language offers you. That does not mean that your Groovy scripts will be deprecated in the future — they will still be supported. Rather, it means you now have the choice to choose whatever suits you best and you think makes you more productive.

To get you started, I compiled a small, practical screencast on how to turn a simple Java Gradle project, into a Java Gradle project with the Kotlin DSL. After watching it, you should have a good grasp of how the Kotlin DSL works and what the current advantages and disadvantages of using it are. Enjoy!

build, gradle, groovy, java, kotlin dsl

Published at DZone with permission of Marco Behler . See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}