Kotlin Scripting 2024: Simplified and Sharpened

Kotlin Scripting 2024: Simplified and Sharpened

Imagine having a tool that lets you write code without worrying about compiling or creating full-fledged applications. That’s Kotlin scripting—a handy feature for quick experiments, build configurations and automation.

But as it turns out, not everything is perfect in scripting land. In 2024, JetBrains is reshaping how Kotlin scripting fits into the ecosystem, focusing on what truly matters while letting go of what doesn’t.

Here’s what you need to know.

Why Change?

Kotlin scripting has been around for years, but it hasn’t gained the traction expected. Tools like Gradle Kotlin DSL and .main.kts scripts are widely used, but the rest of the ecosystem—like generic scripting and the REPL (Read-Eval-Print Loop)—is underwhelming in popularity and performance. JetBrains wants to make scripting simpler, faster, and more relevant, so they’re doubling down on what works and moving away from what doesn’t.

What’s Staying?

Basic Scripting (.kts files)

  • .kts files let you write Kotlin code that runs like a script—no packaging or executables required.
  • JetBrains will keep supporting this functionality but won’t promote Kotlin as a replacement for dedicated scripting languages like Python.

Custom Scripting API

  • If you’re using Kotlin scripting for specialized tasks (like Gradle build scripts), don’t worry—it’s staying!
  • However, it’s experimental and might not get the polish or documentation of Kotlin’s core features.

Main.kts Scripts

  • Perfect for quick automation tasks, these scripts support dependencies and are widely adopted.
  • Expect improvements in functionality and IDE integration.

What’s Changing?

Kotlin REPL is Retiring

  • The REPL (both in the Kotlin compiler and IntelliJ IDEA) hasn’t evolved much.
  • JetBrains is pushing developers toward Kotlin Notebook and Scratch files for interactive coding instead.
  • If you rely on the REPL, it will still work until Kotlin 2.3 but in a compatibility mode.

Dropping Obsolete Tools

Tools like JSR-223, KotlinScriptMojo, and kotlin-scripting-ide-services are being phased out due to limited use or compatibility challenges with newer Kotlin versions.

Why These Changes Matter

JetBrains wants Kotlin scripting to be powerful yet streamlined. By focusing on tools like Gradle DSL and Kotlin Notebook, they can deliver a better experience for the most popular use cases. This focus frees up resources to improve Kotlin itself while still giving scripting fans enough to work with.

What’s Next?

If you’re using Kotlin scripting, your feedback matters! JetBrains is keen to hear your use cases and suggestions as they shape the future of scripting in Kotlin. You can share your thoughts via comments or create issues on YouTrack.


Kotlin scripting is evolving to stay lean and effective. While some features are being sunset, the core tools are only getting better. Let’s look forward to a more focused and capable Kotlin ecosystem!

要查看或添加评论,请登录

Aashiya Mittal的更多文章