Programmatic way to run kotlin as a scripting language via JSR 223 or a homegrown api?


#1

Is there any plan to be able to run a script written in kotlin programmatically and inject variables similarly to groovy or nashorn? It seems like with the upcoming gradle build script support it will have to be possible to have something like this.


#2

You can use https://github.com/holgerbrandl/kscript


#3

Yes, we do plan to support JSR 223, even though it’s not actually related to the Gradle work we’re currently doing.


#4

You can use my DynKT project under https://github.com/xafero/dynkt .
I could contribute it to Kotlin as well, if there’s interest.


#5

Someone recommended your project to me on twitter yesterday. It looks like it’ll fit my needs (especially since it works with OSGi out of the box), but I haven’t had a chance to play with it yet. All I’ve done so far is poke around the code.


#6

Any updates to post on this?


#7

JSR 223 has been supported since Kotlin 1.1.


#8

Discovered that a bit later. Thank you. Sorry to bother