ritesh
05/09/2025, 3:11 PMDaniel Pitts
05/10/2025, 4:41 PMRob Elliot
05/24/2025, 7:36 PMAndrewStone
06/27/2025, 8:56 PMdarkmoon_uk
06/29/2025, 1:17 AM.kts scripts instead of `.sh`; keeping more complex scripts in a powerful, familiar language.
Unfortunately the usefulness of kts is unduly limited by IntelliJ IDE's failure to resolve symbols across @file:Import dependencies - this is an essential feature for composing scripts together e.g. importing some library functions from a common.kts - meanwhile the scripts still run fine, it's just IDE support that's lacking.
This problem has only become more impactful with junie Junie; as the agent sees 'unresolved' false positives and erroneously act upon them, struggling for a fix that never comes.
kodee sad This limitation is very sad, given it's been hanging for over 2 years...
KTIJ-16352 Scripts / IDE: unresolved reference when trying to import file in main.kts scripts with @Import annotation
Any insights into this issue in or outside of JB? Is scripting just abandoned beyond what's needed for Gradle? Such a shame, it's a killer feature in my book.Stylianos Gakis
07/04/2025, 2:35 PM- name: This works
run: echo SOME_VAR=asd >> $GITHUB_ENV
- name: Using it
run: echo $SOME_VAR
env:
SOME_VAR: ${{ env.SOME_VAR }}
And this works perfectly fine.
In Kotlin I try to do:
runCommand("echo SOME_VAR=asd >> \$GITHUB_ENV")
(where runCommand comes from here https://github.com/apollographql/apollo-kotlin/blob/65dd7a44a74ed016988777521248da164de32ea0/scripts/bump-kotlin-nightlies.main.kts#L71C1-L85C2 basically using ProcessBuilder)
And then I try to do the same exact Using it task, but nothing at all gets printed. The contents of SOME_VAR are just empty.
Is this some issue with ProcessBuilder, or something I am doing which is wrong here?embonnin
07/27/2025, 2:58 PM*.main.kts file? Like output or something? It won't import my dependencies but I'm unsure why...joseph_ivie
07/28/2025, 3:27 PM*.main.kts? It would be incredibly useful.Olaf Gottschalk
08/01/2025, 5:10 AMBasicScriptingHost.eval(...) function to run script code, is there any way, a script can programmatically add elements to the reports property of the ResultWithDiagnostics that it returns?
In some situations that are caught at runtime of my script, I want to return a warning just like a compiler warning, but my script can only detect this at runtime like when a user does something they are not intended to do. My current "solution" is to log a warning using a logger... but this is really not what I want. I need this information as a side-information along with the result of the script evaluation. So, ideally, in my script, I would like to call a function that adds elements to this collection of ScriptDiagnostic elements with a severity of warning...
Is that possible?Tim Putnam
08/05/2025, 8:30 PMBasicJvmScriptingHost embedded in an application that's dynamically loading JPMS modules using ModuleLayer.
I simply want the classloader from this ModuleLayer to be visible to the compiler. I"m setting baseClassLoader in the host configuration thus:
val hostconf = ScriptingHostConfiguration {
jvm {
baseClassLoader(appClassloader)
}
}
I've also tried a variety of ways to set the classloader in the ScriptCompilationConfiguration but to no avail. I don't want to add explicit jars (e.g. dependenciesFromClassloader() ). I just want it to use a provided classloader, but it always just uses the main/boot classloader.
This is something I've had working at some stage in the pass, but now doesn't seem to.
I feel like I'm missing something obvious - it seems to want external files? Please, any pointers?darkmoon_uk
08/23/2025, 12:02 AM.kts files instead of Bash, to perform more complex steps; like preparing ECS Deployment tasks.
The good news is - GitHub Actions images already include kotlin, so no complex preparation steps, just run: kotlin myScript.main.kts and off you go! kodee happyPaul Woitaschek
09/07/2025, 5:10 PMmikehearn
09/15/2025, 12:58 PMmikehearn
09/15/2025, 1:54 PM@file:DependsOn unless you do this because correct resolution of those artifacts requires Maven model building. There are likely other edge cases too.
Please note that I didn't bother implementing any support for options as I don't use them. But it should be easy enough to see how to do it.
Hope that helps!Primoz Delopst
09/16/2025, 9:08 PMPrimoz Delopst
09/26/2025, 6:36 AMy9san9
09/27/2025, 5:24 PMS.
10/11/2025, 3:21 PMShaun Wild
10/24/2025, 11:37 AMShaun Wild
10/24/2025, 5:38 PMShaun Wild
10/25/2025, 4:15 PMColton Idle
10/28/2025, 3:11 PMCaleb Miles
10/30/2025, 7:41 PMrefineConfiguration#onAnnotations
We would like to just implement the basic DependsOn,Repository,Import,and CompilerOptions however whenever I specify annotations in onAnnotations I get this:
unable to load class kotlin.script.experimental.dependencies.DependsOn. It seems to error on whichever annotation is first in the list. For the life of me I cannot figure this out.
refineConfiguration {
onAnnotations(DependsOn::class, Repository::class, Import::class, CompilerOptions::class, handler = AnnotationProcessor())
}
I can send a link to the repo if needed 🙂
Any help is much appreciated.Shaun Wild
11/01/2025, 12:50 AMShaun Wild
11/01/2025, 1:17 AMShaun Wild
11/02/2025, 7:14 PMShaun Wild
11/02/2025, 7:15 PMedwinRNDR
11/05/2025, 9:04 AMedwinRNDR
11/07/2025, 10:51 AMBasicJvmScriptingHost such that I can get exceptions thrown during script evaluation?Draget
11/09/2025, 12:33 AM#!/usr/bin/env kotlin
@file:DependsOn("com.squareup.okhttp3:okhttp:5.3.0")
import okhttp3.OkHttpClient
println(OkHttpClient())
Am I missing something? Thought I could define dependencies like this - but it always fails with
test.main.kts:3:8: error: unresolved reference 'okhttp3'.
import okhttp3.OkHttpClient