36

I looked for similar questions, I found this:

Expression type DslEntry must conform to Def.SettingsDefinition in SBT file at line enablePlugins(JavaServerAppPackaging)

My issue is similar, but happens in every row.

image link

When I try to run, it compiles and runs successfully. When I click "Import Project", the yellow notification does not disapear, but the project reloads successfully. If I rewrite any row as, for example, val _ = scalaVersion := "2.12.4", the error disapear, but it looks awful.

dkim
  • 3,930
  • 1
  • 33
  • 37
Rafael Leal
  • 461
  • 4
  • 6
  • 1
    Did you import your project as `sbt project`? Which verison of Idea & Scala plugin are you using? – Oleg Pyzhcov Feb 16 '18 at 12:02
  • 1
    yes, even shows on sbt tool window. I just updated Idea and its plugins, Idea its on 2017.3.4 Build #IU-173.4548.28 Scala plugin its on 2017.3.11.1 – Rafael Leal Feb 17 '18 at 11:12
  • 1
    I have same problem. – mgosk Feb 21 '18 at 20:49
  • These bugs are still not fixed in 2021, and will never be. All those voodoo solutions sometimes work and sometimes don't, because they don't identify and deal with the fundamental flawed design. – rapt Dec 18 '20 at 10:22

4 Answers4

20

I closed and removed the project in IntelliJ, then, in my project folder, I removed the subfolders project/, target/ and .idea/. Then there were remaining only build.sbt and src/. Afterwards, in IntelliJ, I did: File -> New -> Project from existing sources -> import project from external model -> sbt.

This procedure has generated a new .idea Project file.

Expression type Def.Setting[String] must conform to DslEntry in SBT file has been gone now.

Hope this helps.

UPDATE 2018-11-17:

When shuffling with modules and projects in IntellIJ SBT, try replacing

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

with an always distinguished

lazy val root = Project(id="module_xyz", base = file("."))

In my case, the problem was solved this way! It occured from having multiple (project in file(".")) in different modules/build.sbt files belonging to the same IntelliJ SBT project. It seems to me that there can only be one (project in file(".")) in an IntelliJ SBT multi module project. So having many different Project(id="module_xyz", base = file(".")) can solve this.

Hartmut Pfarr
  • 5,534
  • 5
  • 36
  • 42
  • 1
    I was facing some build issues with `sbt` following a **package re-shuffle**, so I deleted the `.idea`, `target` and did `sbt clean --clean-files` and also made some changes in `build.sbt`. Thereafter opening the project in `IntelliJ` started giving me this error. All I did was to close the project, **remove it from `IntelliJ`'s *recently opened..* list** and then **re-import** it as `sbt project` and it worked like a charm [`SBT 1.1.6`, `Scala 2.12.6`, `Java 1.8`] – y2k-shubham Jun 17 '18 at 08:32
20

I had the same issue. This solution worked me everytime. 1. Click on sbt tab of right side in IntelliJ Idea 2. Click on Refresh symbol

It will revalidate the Local cache and Gradle dependencies. That's it.

Yogesh Funde
  • 767
  • 6
  • 13
  • 1
    Thanks - a much easier solution. One thing - the project/sbt file has to appear in the sbt tab. If it isn't there or isn't showing, use the + button on the sbt tab top toolbar to show it. – Anthony Holland Oct 01 '18 at 16:54
  • 3
    After doing this, I had to restart intellij before the red lines would go away. – Janac Meena Feb 10 '19 at 01:18
1

You can also try cutting and pasting everything in your build.sbt file to a word doc, importing your changes, and then pasting it back into the build.sbt file.

Brian Buh
  • 11
  • 1
0

I simply installed the newest sbt version on my system and updated project/build.properties so it contains the new version number. This solved the issue for me. You might have to trigger a refresh in IntelliJ manually.

lex82
  • 11,173
  • 2
  • 44
  • 69