IntelliJ cannot resolve symbol in build.sbt

你说的曾经没有我的故事 提交于 2020-01-12 04:53:08

问题


IntelliJ IDEA 15 is reporting an unresolved symbol for my project definition in my build.sbt file

lazy val root = (project in file(".")).enablePlugins(PlayScala)

It's reporting an error with project and in.

Cannot resolve symbol project.
Cannot resolve symbol in.

Everything else resolves perfectly and the project is otherwise all set up, sbt builds fine, activator runs fine.


回答1:


To fix this issue, I imported: import sbt.project on top of my build.sbt

I am working with IntelliJ IDEA 16 EAP




回答2:


I looked on jetbrains' error tracker and found this is a known bug.

"Cannot resolve symbol project" in build.sbt

https://youtrack.jetbrains.com/issue/SCL-9512




回答3:


In my case, after upgrading Intellij forgot that the project was a Scala project.

Delete .idea/ and import the project to fix this.




回答4:


This happened to me when when the "external library" referenced was a different version than the one stated in the build.sbt file. Specifically:

External Libraries -> SBT: org.scala-lang:scala-library:2.12.1

build.sbt -> scalaVersion := "2.12.2"



来源:https://stackoverflow.com/questions/34245991/intellij-cannot-resolve-symbol-in-build-sbt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!