Tmpod
01/23/2020, 1:47 PMprintln("foo")
.
Here's the error:
wrong number of arguments
ERROR
sp: null
e: java.lang.IllegalArgumentException: wrong number of arguments
null ; null
---
null
btw, scriptResource
is just getting a resource from the calss loader, like this: val scriptResource = ModuleScript::class.java.classLoader.getResource("scripts/test.kts")
Any idea what the issue might be?Tmpod
01/25/2020, 10:03 PMRick Fast
01/26/2020, 11:16 PM@KotlinScript
:Jakub Gwóźdź
01/27/2020, 1:53 PM% cat script/Environment.ws.kts
println("sql:" + javax.sql.DataSource::class.java)
% kotlinc -Xadd-modules=java.sql -script script/Environment.ws.kts
java.lang.NoClassDefFoundError: javax/sql/DataSource
at Environment_ws.<init>(Environment.ws.kts:1)
gianluz
02/09/2020, 8:51 PM.main.kts
script, where i would like to use a local jar directly from my maven local without using -cp
option at compile time.. something using @file:Repository("path/to/mavenlocal")
and then @file:DependsOn("groupId:artifactId:version")
i’m using the version 1.3.61 😕 any idea??edwinRNDR
02/12/2020, 3:04 PMBasicJvmScriptingHost
and dependenciesFromCurrentContext(wholeClasspath = true)
and one repeatedly loads the same script with small changes?SrSouza
02/15/2020, 3:56 PMEgor
02/17/2020, 1:32 PMLeon K
02/19/2020, 10:35 AMSrSouza
03/03/2020, 9:37 PMLeon Linhart
03/04/2020, 1:34 PMjava.lang.IllegalAccessException: class kotlin.reflect.jvm.internal.KClassImpl$Data$objectInstance$2 cannot access a member of class com.github.themrmilchmann.kwiki.dsl.SiteScriptCompilationConfiguration with modifiers "public static final"
(I will include the full stacktrace as a thread comment.)
However, my compilation configuration is a public object as shown in examples in this channel before. (object SiteScriptCompilationConfiguration : ScriptCompilationConfiguration({ ... })
)
Now my actual question is what I can do to debug this further? (Could this be an issue caused by using Java 11 as IDE runtime?)fcosta
03/04/2020, 9:28 PM$ ./jvm/main-kts/scripts/kotlin-shell.main.kts
:: problems summary ::
:::: WARNINGS
module not found: eu.jrie.jetbrains#kotlin-shell-core;0.2.1
==== central: tried
<https://repo1.maven.org/maven2/eu/jrie/jetbrains/kotlin-shell-core/0.2.1/kotlin-shell-core-0.2.1.pom>
-- artifact eu.jrie.jetbrains#kotlin-shell-core;0.2.1!kotlin-shell-core.jar:
<https://repo1.maven.org/maven2/eu/jrie/jetbrains/kotlin-shell-core/0.2.1/kotlin-shell-core-0.2.1.jar>
error: cannot access script base class 'org.jetbrains.kotlin.mainKts.MainKtsScript'. Check your module classpath for missing or conflicting dependencies (kotlin-shell.main.kts:3:1)
error: unresolved reference: Repository (kotlin-shell.main.kts:3:7)
error: unresolved reference: DependsOn (kotlin-shell.main.kts:4:7)
error: unresolved reference: DependsOn (kotlin-shell.main.kts:5:7)
error: unresolved reference: CompilerOptions (kotlin-shell.main.kts:6:7)
error: unresolved reference: kotlinx (kotlin-shell.main.kts:7:13)
error: an annotation argument must be a compile-time constant (kotlin-shell.main.kts:7:13)
error: unresolved reference: eu (kotlin-shell.main.kts:9:8)
error: unresolved reference: shell (kotlin-shell.main.kts:11:1)
error: unresolved reference: args (kotlin-shell.main.kts:12:9)
error: expression '"ls -l"' of type 'String' cannot be invoked as a function. The function 'invoke()' is not found (kotlin-shell.main.kts:13:9)
error: unresolved reference: pipeline (kotlin-shell.main.kts:21:9)
error: unresolved reference: args (kotlin-shell.main.kts:22:20)
error: unresolved reference: process (kotlin-shell.main.kts:22:30)
error: unresolved reference: streamLambda (kotlin-shell.main.kts:23:21)
error: cannot infer a type for this parameter. Please specify it explicitly. (kotlin-shell.main.kts:23:36)
error: cannot infer a type for this parameter. Please specify it explicitly. (kotlin-shell.main.kts:23:42)
error: cannot infer a type for this parameter. Please specify it explicitly. (kotlin-shell.main.kts:23:45)
error: expression '"wc ${args[0]}"' of type 'String' cannot be invoked as a function. The function 'invoke()' is not found (kotlin-shell.main.kts:44:9)
error: unresolved reference: args (kotlin-shell.main.kts:44:15)
jvm/main-kts/scripts/kotlin-shell.main.kts: error: unresolved dependency: eu.jrie.jetbrains#kotlin-shell-core;0.2.1: not found
jvm/main-kts/scripts/kotlin-shell.main.kts:3:1: error: cannot access script base class 'org.jetbrains.kotlin.mainKts.MainKtsScript'. Check your module classpath for missing or conflicting dependencies
@file:Repository("<https://dl.bintray.com/jakubriegel/kotlin-shell>")
^
jvm/main-kts/scripts/kotlin-shell.main.kts:3:7: error: unresolved reference: Repository
@file:Repository("<https://dl.bintray.com/jakubriegel/kotlin-shell>")
^
jvm/main-kts/scripts/kotlin-shell.main.kts:4:7: error: unresolved reference: DependsOn
@file:DependsOn("eu.jrie.jetbrains:kotlin-shell-core:0.2.1")
^
jvm/main-kts/scripts/kotlin-shell.main.kts:5:7: error: unresolved reference: DependsOn
@file:DependsOn("org.slf4j:slf4j-simple:1.7.28")
^
jvm/main-kts/scripts/kotlin-shell.main.kts:6:7: error: unresolved reference: CompilerOptions
@file:CompilerOptions("-Xopt-in=kotlin.RequiresOptIn")
^
jvm/main-kts/scripts/kotlin-shell.main.kts:7:13: error: unresolved reference: kotlinx
@file:OptIn(kotlinx.coroutines.ExperimentalCoroutinesApi::class)
^
jvm/main-kts/scripts/kotlin-shell.main.kts:7:13: error: an annotation argument must be a compile-time constant
@file:OptIn(kotlinx.coroutines.ExperimentalCoroutinesApi::class)
^
jvm/main-kts/scripts/kotlin-shell.main.kts:9:8: error: unresolved reference: eu
import eu.jrie.jetbrains.kotlinshell.shell.*
^
jvm/main-kts/scripts/kotlin-shell.main.kts:11:1: error: unresolved reference: shell
shell {
^
jvm/main-kts/scripts/kotlin-shell.main.kts:12:9: error: unresolved reference: args
if (args.isEmpty()) {
^
jvm/main-kts/scripts/kotlin-shell.main.kts:13:9: error: expression '"ls -l"' of type 'String' cannot be invoked as a function. The function 'invoke()' is not found
"ls -l"()
^
jvm/main-kts/scripts/kotlin-shell.main.kts:21:9: error: unresolved reference: pipeline
pipeline {
^
jvm/main-kts/scripts/kotlin-shell.main.kts:22:20: error: unresolved reference: args
"cat ${args[0]}".process() pipe
^
jvm/main-kts/scripts/kotlin-shell.main.kts:22:30: error: unresolved reference: process
"cat ${args[0]}".process() pipe
^
jvm/main-kts/scripts/kotlin-shell.main.kts:23:21: error: unresolved reference: streamLambda
streamLambda { strm, _, _ ->
^
jvm/main-kts/scripts/kotlin-shell.main.kts:23:36: error: cannot infer a type for this parameter. Please specify it explicitly.
streamLambda { strm, _, _ ->
^
jvm/main-kts/scripts/kotlin-shell.main.kts:23:42: error: cannot infer a type for this parameter. Please specify it explicitly.
streamLambda { strm, _, _ ->
^
jvm/main-kts/scripts/kotlin-shell.main.kts:23:45: error: cannot infer a type for this parameter. Please specify it explicitly.
streamLambda { strm, _, _ ->
^
jvm/main-kts/scripts/kotlin-shell.main.kts:44:9: error: expression '"wc ${args[0]}"' of type 'String' cannot be invoked as a function. The function 'invoke()' is not found
"wc ${args[0]}"()
^
jvm/main-kts/scripts/kotlin-shell.main.kts:44:15: error: unresolved reference: args
"wc ${args[0]}"()
^
Paul Woitaschek
03/06/2020, 8:31 AMTmpod
03/10/2020, 4:15 PMide { acceptedLocations(ScriptAcceptedLocation.Everywhere) }
in the compilation settingsLuis Munoz
03/16/2020, 3:40 PMPaul Woitaschek
03/20/2020, 8:36 AMkotlin my-script.main.kts --hello
the compiler doesn't pass it through:
error: invalid argument: --hello
Paul Woitaschek
03/20/2020, 9:49 AMCzar
03/26/2020, 1:24 PMFlow<String>
Attached is a scratch file I'm playing in, it prints test
whereas I expect it to print Z: test
if output redirection worked. Any idea what am I doing wrong? Or is Kotlin ScriptEngine just ignoring context that is passed in to eval?Paul Woitaschek
03/27/2020, 2:01 PMfalse
and the second execution throws a KotlinReflectionNotSupportedError
?Nikky
03/27/2020, 7:05 PMCannot inline bytecode built with JVM target 1.8 into bytecode that is being built with JVM target 1.6. Please specify proper '-jvm-target' option
i have thise code in place... and it used to work
compilerOptions.append("-jvm-target 1.8")
has anything changed there ?Paul Woitaschek
03/28/2020, 8:26 AM@file:CompilerOptions("-Xuse-experimental=kotlin.ExperimentalStdlibApi")
Nikky
03/29/2020, 2:35 AMide.dependencySources
do ? can i make the ide know about which files are used as dependencies (instead of all files in sources) ?
that wuld be useful, because i have multiple scripts that have different files they use as dependencies each.. but the ide does not look at the importScripts
that are usedLorin
04/01/2020, 1:43 AM@KotlinScript(fileExtension = "simplescript.kts")
abstract class SimpleScript
fun main() {
val config = createJvmCompilationConfigurationFromTemplate<SimpleScript> {
jvm {
dependenciesFromCurrentContext(wholeClasspath = true)
}
}
val s = """
println("This is a test!")
""".trimIndent()
val res = BasicJvmScriptingHost().eval(s.toScriptSource(), config, null)
println(res)
}
Running this program, the output is as follows:
This is a test!
Success(value=EvaluationResult(returnValue=Unit, configuration=kotlin.script.experimental.api.ScriptEvaluationConfiguration@a9a8cb94), reports=[])
Though the evalution of this script is successful, EvaluationResult.returnValue
is Unit
, which is not expected.
I try to run this program with kotlin-scripting (v1.3.31), the output is:
This is a test!
Success(value=EvaluationResult(returnValue=: = Script_simplescript@3ddf2a72, configuration=kotlin.script.experimental.api.ScriptEvaluationConfiguration@a4b45b1a), reports=[])
It is clear that the script object (Script_simplescript@3ddf2a72) is stored in EvaluationResult.returnValue
, which is the desirable behavior for me.
Could anyone from JB confirm it? Thanks!gammanik
04/02/2020, 1:35 PMsetIdeaIoUseFallback()
val engine = ScriptEngineManager().getEngineByExtension("kts")!!
I’ve added dependencies and /services/javax.script.ScriptEngineFactory
file. But the engine is actually null.mbonnin
04/03/2020, 5:03 PM*.main.kts
support dependencies resolution ? The following doesn't work:
#!/usr/bin/env kotlin
@file:DependsOn("com.squareup.moshi:moshi:1.9.2")
@file:DependsOn("com.squareup.okio:okio:2.4.3")
import okio.source // error: unresolved reference: source
import <http://java.io|java.io>.File
File("foo").source()
if I swap the imports of okio and moshi, it works well though, leading me to think that the script will import the first version it encounters ?jimn
04/04/2020, 4:36 AMGary Tierney
04/05/2020, 6:14 PMSrSouza
04/10/2020, 10:59 PMmbonnin
04/12/2020, 2:34 PM@file:Repository
? I tried @file:Repository("file:///Users/m.bonnin/.m2/repository")
but that doesn't seem to worksteenooo
04/13/2020, 5:57 PMsteenooo
04/13/2020, 5:57 PMilya.chernikov
04/14/2020, 5:03 PMBasicJvmScriptClassFilesGenerator
to get an access to the bytecode.