I was in a project, and I was trying to create a kts file to run some simple commands.
I eventually tested the following file Main.kts
with the following code:
println("test")
I got the following error:
Error:(3, 1) Kotlin: Cannot access script base class 'kotlin.script.templates.standard.ScriptTemplateWithArgs'. Check your module classpath for missing or conflicting dependencies
I then tried a whole new Kotlin project (from Intellij) and made a kts
file inside the src
directory. It had the same error.
Then I moved the kts file outside of the src directory. It worked. I then moved it back into the src directory, unmarked src as a sources directory, and it worked.
Without it marked as a src directory, I get no syntax highlighting, but it works.
Is there anyway to create a script file in Intellij, get syntax highlighting, and have it run? Preferably in the directory marked as sources?