So, besides “regular” Kotlin scratch files, reading through the Kotlin 1.3.70 announcement made me believe it should also easily be possible to create “main.kts” scratches files that automatically have
kotlin-main-kts.jar added to their classpath. However, it does not work for me. This is what I did:
In a Kotlin 1.5.10 project loaded into IDEA 2021.1.2 Ultimate, I chose
Scratch File →
Kotlin. As this creates a file named “scratch.kts” be default, I went ahead, right-clicked in the tab, chose
Rename File... and renamed it to “scratch.main.kts”. Then I started typing
@file:DependsOn("com.fasterxml.jackson.module:jackson-module-kotlin:2.12.3"), but the IDE tells me
Unresolved reference: DependsOn.
So how can I get “main.kts” scratch files / scratch files in which I call pull dependencies to work?