简体   繁体   English

intellij 的 scala 插件无法识别 build.sbt 中的符号

[英]intellij's scala plugin is not recognizing symbols in build.sbt

I imported an existing working sbt project.我导入了一个现有的工作 sbt 项目。 Intellij is highlighting many things in the sbt file as errors: Intellij 将 sbt 文件中的许多内容突出显示为错误:

lazy val core = project.in(file("core")) "Cannot resolve symbol project" lazy val core = project.in(file("core")) "无法解析符号项目"

"Cannot resolve symbol file" “无法解析符号文件”

scalaVersion := "2.11.8" "Cannot resolve symbol scalaVersion" scalaVersion := "2.11.8" "无法解析符号 scalaVersion"

I have the latest version of intellij and the latest version of the scala plugin.我有最新版本的 intellij 和最新版本的 scala 插件。

Try this.尝试这个。

Click File -> Synchronize, and IntelliJ should see that everything is okay again.单击 File -> Synchronize,IntelliJ 应该会再次看到一切正常。

If that doesn't work, IntelliJ's caches might be corrupt (this used to happen a lot more often than it does now);如果这不起作用,则 IntelliJ 的缓存可能已损坏(过去发生这种情况的频率比现在要高得多); in that case, regenerate them by在这种情况下,通过

Clicking File -> Invalidate Caches and restarting the IDE单击 File -> Invalidate Caches 并重新启动 IDE

I faced with this problem right after I saw your question.看到你的问题后我就遇到了这个问题。 I have tried everything Junaid said but it did not work.我已经尝试了朱奈德所说的一切,但没有奏效。 Afterwards, I have re-imported the project by selecting build.sbt file and everything worked well.之后,我通过选择build.sbt文件重新导入了项目,一切正常。

Whenever IntelliJ could not find Scala SDK or show errors on build.sbt file, just try to re-import project by selecting build.sbt .每当 IntelliJ 找不到 Scala SDK 或在build.sbt文件上显示错误时,只需尝试通过选择build.sbt重新导入项目。 It should work.它应该工作。

I hope it helps!我希望它有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM