kotlin-language-server icon indicating copy to clipboard operation
kotlin-language-server copied to clipboard

No script runtime was found in the classpath: class 'kotlin.script.templates.standard.ScriptTemplateWithArgs' not found. Please add kotlin-script-runtime.jar to the module dependencies.kotlin(MISSING_SCRIPT_STANDARD_TEMPLATE)

Open cebaa opened this issue 5 years ago • 18 comments

Describe the bug All lines in build.gradle.kts have this error:

No script runtime was found in the classpath: class 'kotlin.script.templates.standard.ScriptTemplateWithArgs' not found. Please add kotlin-script-runtime.jar to the module dependencies.kotlin(MISSING_SCRIPT_STANDARD_TEMPLATE)

Extension version 0.2.11

Additional context gradle 0.6.1 kotlin jvm plugin 1.3.61 Used through Remote SSH on a remote Linux server gradle run from the command line on the server runs the app fine

Let me know what additional info I should provide to help troubleshooting.

cebaa avatar Dec 20 '19 20:12 cebaa

Just noticed that this was reported before as https://github.com/fwcd/kotlin-language-server/issues/159 - I guess the exception was not in textual form, but a screenshot instead, so I could not find it.

I'm not sure if these are duplicates since the current title of the #159 is "Ensure that Kotlin Script Runtime is on classpath in non-Gradle/Kotlin DSL projects", but if it is or if you want to track in one or another, might be good to either merge or close one or the other.

cebaa avatar Dec 23 '19 16:12 cebaa

So how does one solve this problem?

tobia avatar Jan 31 '20 17:01 tobia

+1

neilabdev avatar Mar 15 '20 17:03 neilabdev

+1

Repo is here, which used to work before I re-installed my VSCode. Now I cannot run any test.

Somehow, after I installed this extension, everything works fine on my VSCode.

idiotleon avatar May 29 '20 05:05 idiotleon

I had this same issue in build.gradle.kts file, i am using coc.nvim

aripiprazole avatar Jun 07 '20 23:06 aripiprazole

@LorenzooG, same here

ploth avatar Aug 14 '20 11:08 ploth

This must be a bug since kotlin-language-server:83 sets the classpath to

CLASSPATH=...:$APP_HOME/lib/kotlin-script-runtime-1.3.50.jar:...

($APP_HOME confirmed to be correct) kotlin-script-runtime-1.3.50.jar contains the necessary class file. image

Test.kts: image

ploth avatar Aug 14 '20 12:08 ploth

HelloWorldKotlin.iml file have a senctance about "<orderEntry type="sourceFolder" forTests="false" />";just turn on forText is OK;

BluceKing avatar Aug 21 '20 10:08 BluceKing

Anybody found solution?

eiva avatar Oct 15 '20 23:10 eiva

Where we can start looking for contributing? Would be nice to have .kts file support.

sigmasoldi3r avatar Dec 20 '20 09:12 sigmasoldi3r

+1

Repo is here, which used to work before I re-installed my VSCode. Now I cannot run any test.

Somehow, after I installed this extension, everything works fine on my VSCode.

For me it does not solve the problem, the extension just stops working (And thus no errors are shown). Maybe it has more priority one extension than another?

sigmasoldi3r avatar Dec 20 '20 10:12 sigmasoldi3r

This error vanished for me when I restarted vscode.

tekumara avatar Dec 21 '20 04:12 tekumara

I can confirm the same happening as well after installing the extension for gradle.kts files. All Kotlin (.kt) files get detected correctly however. Restarting VSCode did not solve the issue.

jlengrand avatar Apr 24 '21 14:04 jlengrand

Same issue here, present after restarting.

eiiot avatar Dec 29 '21 03:12 eiiot

+1

gimbling-away avatar Feb 06 '22 12:02 gimbling-away

I'm having this same issue.

devmike01 avatar Feb 17 '22 14:02 devmike01

This can happen when your project's classpath doesn't contain the kotlin-script-runtime jar.

In my case, my project's pom.xml was incorrect and it didn't resolve and so the jar was missing from the dependency tree.

Once I fixed pom.xml it became visible in the Maven window:

Screen Shot 2022-03-18 at 3 46 09 pm

I then went to Command Palette - Kotlin: Restart the Language Server to resolve the issue.

tekumara avatar Mar 18 '22 04:03 tekumara

This can happen when your project's classpath doesn't contain the kotlin-script-runtime jar.

In my case, my project's pom.xml was incorrect and it didn't resolve and so the jar was missing from the dependency tree.

Once I fixed pom.xml it became visible in the Maven window:

Screen Shot 2022-03-18 at 3 46 09 pm

I then went to Command Palette - Kotlin: Restart the Language Server to resolve the issue.

I'm transitioning from using groovy Gradle scripts to Kotlin and installed this extensions and had the issue listed in this ticket. Going to Command Palette and executing Kotlin: Restart the Language Server resolved the issue for me as well. Also running VS Code with the Remote SSH extension.

VS Code: 1.73.1 Gradle: 7.5.1 Kotlin Extensions: v0.2.26

A couple things:

  • When using Gradle for Java extension in VS Code, the classpath for gradle and the language server extensions can out of sync. Often I have to restart the Java Language Server (Alt+Shift+U) and seems to be the case for restarted the Kotlin Language server as well.

Chasson1992 avatar Dec 04 '22 22:12 Chasson1992