Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/kotlin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在获取';请将kotlin-script-runtime.jar添加到模块依赖项&x27;错误?_Kotlin_Gradle - Fatal编程技术网

如何在获取';请将kotlin-script-runtime.jar添加到模块依赖项&x27;错误?

如何在获取';请将kotlin-script-runtime.jar添加到模块依赖项&x27;错误?,kotlin,gradle,Kotlin,Gradle,以下是错误日志: ./gradlew :clean :cleanTest :test -Ddebug=true -PenvironmentName=PROD --tests="*dummytest" > Task :compileKotlin FAILED e: /home/gpligoropoulos/xm/research_portal/rp_api_automation/src/main/kotlin/Person.kts: (1, 1): No script

以下是错误日志:

./gradlew :clean :cleanTest :test -Ddebug=true -PenvironmentName=PROD --tests="*dummytest"

> Task :compileKotlin FAILED
e: /home/gpligoropoulos/xm/research_portal/rp_api_automation/src/main/kotlin/Person.kts: (1, 1): 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.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileKotlin'.
> Compilation error. See log for more details

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 2s
3 actionable tasks: 2 executed, 1 up-to-date

解决方案是简单地在kotlin脚本运行时中添加一行依赖项

与此类似:

dependencies {
...
    // https://mvnrepository.com/artifact/org.jetbrains.kotlin/kotlin-script-runtime
    compile group: 'org.jetbrains.kotlin', name: 'kotlin-script-runtime', version: '1.4.10'
...
}