I’ve tried creating an intellij plugin to add a custom kotlin script support via the SciptDefinitionsProvider endpoint. I managed (after some extended period of time) to get it working, that ide recognizes the plugin, associates my kts script extension with it and even the intellisense works great, when I write a script with this extension, it shows no errors, shows context-aware hints, like showing packages of the custom classes I use, showing method parameter names and I can even use the decompiler to inspect their code. Unfortunately, when I try to run the script, I get this error. I have no idea how to debug it. I tried making changes in the dependency list and classpath and nothing helped. Can anyone please help suggesting what may be the cause or how to solve it?
I add the scripting libraries like this
compileOnly("org.jetbrains.kotlin:kotlin-scripting-common")
compileOnly("org.jetbrains.kotlin:kotlin-scripting-jvm")
compileOnly("org.jetbrains.kotlin:kotlin-scripting-intellij")
exception: java.lang.NoSuchMethodError: 'java.lang.Object org.jetbrains.kotlin.config.CommonConfigurationKeysKt.getScriptingHostConfiguration(org.jetbrains.kotlin.config.CompilerConfiguration)'
at org.jetbrains.kotlin.scripting.compiler.plugin.ScriptingK2CompilerPluginRegistrar$Companion.registerComponents(pluginRegisrar.kt:98)
at org.jetbrains.kotlin.scripting.compiler.plugin.ScriptingK2CompilerPluginRegistrar.registerExtensions(pluginRegisrar.kt:108)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$Companion.registerExtensionsFromPlugins$cli_base(KotlinCoreEnvironment.kt:807)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$ProjectEnvironment.registerExtensionsFromPlugins(KotlinCoreEnvironment.kt:197)
at org.jetbrains.kotlin.cli.pipeline.jvm.JvmScriptPipelinePhase.executePhase$lambda$0(JvmScriptPipelineStep.kt:42)
at kotlin.UnsafeLazyImpl.getValue(Lazy.kt:100)
at org.jetbrains.kotlin.cli.pipeline.jvm.JvmScriptPipelinePhase.executePhase$lambda$1(JvmScriptPipelineStep.kt:36)
at org.jetbrains.kotlin.cli.pipeline.jvm.JvmScriptPipelinePhase.executePhase(JvmScriptPipelineStep.kt:50)
at org.jetbrains.kotlin.cli.pipeline.jvm.JvmScriptPipelinePhase.executePhase(JvmScriptPipelineStep.kt:22)
at org.jetbrains.kotlin.cli.pipeline.PipelinePhase.phaseBody(PipelinePhase.kt:68)
at org.jetbrains.kotlin.cli.pipeline.PipelinePhase.phaseBody(PipelinePhase.kt:58)
at org.jetbrains.kotlin.config.phaser.NamedCompilerPhase.invoke(CompilerPhase.kt:102)
at org.jetbrains.kotlin.backend.common.phaser.CompositePhase.invoke(PhaseBuilders.kt:22)
at org.jetbrains.kotlin.config.phaser.CompilerPhaseKt.invokeToplevel(CompilerPhase.kt:53)
at org.jetbrains.kotlin.cli.pipeline.AbstractCliPipeline.runPhasedPipeline(AbstractCliPipeline.kt:109)
at org.jetbrains.kotlin.cli.pipeline.AbstractCliPipeline.execute(AbstractCliPipeline.kt:68)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecutePhased(K2JVMCompiler.kt:79)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecutePhased(K2JVMCompiler.kt:45)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:90)
at org.jetbrains.kotlin.cli.common.CLICompiler.exec(CLICompiler.kt:352)
at org.jetbrains.kotlin.cli.common.CLICompiler.exec(CLICompiler.kt:330)
at org.jetbrains.kotlin.cli.common.CLICompiler.exec(CLICompiler.kt:294)
at org.jetbrains.kotlin.cli.common.CLICompiler$Companion.doMainNoExit(CLICompiler.kt:431)
at org.jetbrains.kotlin.cli.common.CLICompiler$Companion.doMainNoExit$default(CLICompiler.kt:426)
at org.jetbrains.kotlin.cli.common.CLICompiler$Companion.doMain(CLICompiler.kt:418)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler$Companion.main(K2JVMCompiler.kt:252)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.main(K2JVMCompiler.kt)
If you need any other info, please don’t hesitate to ask, I just don’t even know which part of the code is relevant as I have no idea what is the cause