You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying kscript for the first time and installed kotlin and kscript with sdkman on Mac and simple execution fails:
% kscript 'println("hello world")'
Exception in thread "main" java.lang.ClassNotFoundException: kscript.scriplet.Scriplet
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:445)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
at Main_Scriplet$Companion.main(Main_Scriplet.kt:5)
at Main_Scriplet.main(Main_Scriplet.kt)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.jetbrains.kotlin.runner.AbstractRunner.run(runners.kt:70)
at org.jetbrains.kotlin.runner.Main.run(Main.kt:188)
at org.jetbrains.kotlin.runner.Main.main(Main.kt:198)
[kscript] [ERROR] Execution of scriplet failed:
[kscript] [ERROR] Command : 'bash -c /Users/dalewking/.sdkman/candidates/kotlin/1.8.20/bin/kotlin -classpath '/Users/dalewking/Library/Caches/kscript/jar_7a6cdcc8b547b2bb2a0ad2ab4f24c291/scriplet.jar:/Users/dalewking/.sdkman/candidates/kotlin/1.8.20/lib/kotlin-script-runtime.jar' Main_Scriplet '
[kscript] [ERROR] Exit Code : 1
[kscript] [ERROR]
Tried with Kotlin 1.9.0 and 1.8.20 since I thought new kotlin version may have been the issue
OK the issue is that it isn't working with Kotlin 1.9. Switching to Kotlin 1.8.20 allows it to work, but it is necessary to clear the cache after switching versions.
Exception in thread "main" java.lang.ClassNotFoundException: kscript.scriplet.Android_lint
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:476)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:589)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
at Main_Android_lint$Companion.main(Main_Android_lint.kt:5)
at Main_Android_lint.main(Main_Android_lint.kt)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.jetbrains.kotlin.runner.AbstractRunner.run(runners.kt:70)
at org.jetbrains.kotlin.runner.Main.run(Main.kt:188)
at org.jetbrains.kotlin.runner.Main.main(Main.kt:198)
We've updated Kotlin version up to 1.9.0 on developer machines and all the scripts got broken, as a result, all local script calls crashed.
Fortunately, on CI it still works as the Docker container has pinned runtime versions.
If you need any help - don't hesitate to ask, as we are heavily relying on kscript in our project to reproduce CI steps locally we consider this issue critical.
I am working on this. The root cause seems to be that Kotlin 1.9 disallows .kts files in the source roots.
Anyway, I recommend pinning the Kotlin version on CI/CD - fixing bugs quickly won't always be possible.
I have just released kscript 4.2.3-RC.1
Please check if everything works as expected in your code - there are changes in the core engine of kscript, so I would like to ensure that nothing is broken after fixing the problem.
Activity
dalewking commentedon Jul 8, 2023
I tried to re-invoke with -d argument to get more info and now it works
dalewking commentedon Jul 8, 2023
Actually it may have been that I also tried a
kscript -cto get it workingdalewking commentedon Jul 8, 2023
OK the issue is that it isn't working with Kotlin 1.9. Switching to Kotlin 1.8.20 allows it to work, but it is necessary to clear the cache after switching versions.
[-]Fresh install not working on Mac[/-][+]Does not work with Kotlin 1.9.0[/+]cgruber commentedon Jul 11, 2023
Same thing here. We just upgraded our cli tools to 1.9 and kscript dies on the same error.
aartiPl commentedon Jul 12, 2023
I will have a look at it.
iamironz commentedon Jul 13, 2023
Same here.
We've updated Kotlin version up to 1.9.0 on developer machines and all the scripts got broken, as a result, all local script calls crashed.
Fortunately, on CI it still works as the Docker container has pinned runtime versions.
If you need any help - don't hesitate to ask, as we are heavily relying on kscript in our project to reproduce CI steps locally we consider this issue critical.
aartiPl commentedon Jul 13, 2023
I am working on this. The root cause seems to be that Kotlin 1.9 disallows .kts files in the source roots.
Anyway, I recommend pinning the Kotlin version on CI/CD - fixing bugs quickly won't always be possible.
iamironz commentedon Jul 14, 2023
Thank you.
Very much appreciated your effort there.
aartiPl commentedon Jul 14, 2023
I have just released kscript 4.2.3-RC.1
Please check if everything works as expected in your code - there are changes in the core engine of kscript, so I would like to ensure that nothing is broken after fixing the problem.
aartiPl commentedon Jul 19, 2023
@cgruber , @dalewking , @iamironz - can you confirm that the issue is fixed?
iamironz commentedon Jul 19, 2023
Works fine for me, thank you so much!
aartiPl commentedon Jul 22, 2023
The final resolution is even simpler, without changing much in the kscript core.
I have just released kscript 4.2.3 with Kotlin 1.9.0 compatibility.