如何在获取';请将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'
...
}