当我使用Gradle Kotlin DSL创建一个空项目时,即使没有进行任何修改,它也会提示“Cannot access script base class 'org.gradle.kotlin.dsl.KotlinBuildScript'. Check your module classpath for missing or conflicting dependencies” 。该项目可以运行,但是
build.gradle.kts
的语法高亮和自动完成功能不起作用。
我尝试过的方法
- https://github.com/gradle/kotlin-dsl-samples/issues/1308
- 将Gradle可执行文件更改为
gradle-kotlin-dsl-5.2-20190122225509+0000-all.zip
- 将Gradle可执行文件更改为
- https://youtrack.jetbrains.com/issue/KT-38296
- 在项目结构对话框中删除空SDK
- 无效缓存并重新启动
- 重新安装Java 11
brew install java11
- 切换到官方Oracle JDK 15
brew install oracle-jdk
- https://youtrack.jetbrains.com/issue/KT-41141
- 在SDK菜单中重新添加SDK
- 将
/Kotlin/kotlinc/lib
添加到Kotlin SDK的类路径中
- http://youtrack.jetbrains.com/issue/IDEA-245027
- 手动删除缓存文件夹
系统
IntelliJ IDEA 2020.3.1 (Ultimate Edition)
Build #IU-203.6682.168, built on December 29, 2020
Licensed to Hykilpikonna Gui
Subscription is active until November 28, 2021.
For educational use only.
Runtime version: 11.0.9.1+11-b1145.63 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
macOS 10.15.7
GC: ParNew, ConcurrentMarkSweep
Memory: 1998M
Cores: 6
Registry: debugger.watches.in.variables=false, js.debugger.webconsole=false
Non-Bundled Plugins: CMD Support, Rider UI Theme Pack, Statistic, com.alayouni.ansiHighlight, com.intellij.ideolog, net.vektah.codeglance, String Manipulation, com.alibaba.p3c.smartfox, wu.seal.tool.jsontokotlin, com.demonwav.minecraft-dev, lermitage.intellij.extra.icons, com.github.masahirosuzuka.PhoneGapIntelliJPlugin, Dart, io.flutter, deno, org.jetbrains.kotlin, com.cybrosis.catdea, siosio.kodkod, izhangzhihao.rainbow.brackets, org.jetbrains.plugins.ruby, Pythonid, org.jetbrains.plugins.vue, tv.twelvetone.intellij.plugins.intellivue, ru.meanmail.plugin.requirements