kotlin: Kotlin scripts are aggressively cached

Tags: til kotlin

Kotlin ships with built in support for convenient scripting, but beware its caching that will not check imported files or dependencies until the entry point script changes:

https://github.com/Kotlin/kotlin-script-examples/blob/master/jvm/main-kts/MainKts.md#caching

If you need to work around this you can set the environment variable KOTLIN_MAIN_KTS_COMPILED_SCRIPTS_CACHE_DIR and kotlin will cache compiled scripts there, so you can delete it when you need to.

See also:

Published on: 12 Jun 2024