Alexandr Alexandr - 6 months ago 41
Scala Question

Intellij IDEA and SBT syntax error

I am newbie in scala and SBT

I started using IDEA with SBT and faced unclear error (Expression type DslEntry must conform to Def.SettingsDefinition in SBT file)

enter image description here

It's very simple empty test project with jetty plugin (example taken from plugin site)

here's plugins.sbt source:

logLevel := Level.Warn

addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "2.1.0")

This error is present only in IDEA GUI. If I compile project - all fine. from console - all fine.
But I do not like when something does not work properly

I tried to download last version of SBT and set path to it in global IDEA properties - the problem persists.

I downloaded last intellij IDEA EAP with last version of scala plugin, sbt plugin and another plugins - the problem persists.

Can anyone help to solve this issue?


Try this:

lazy val root = (project in file(".")).
    name := "test",
    scalaVersion := "2.11.7",
    version := "1.0"

Updates: The followings are what I know:

The error comes from intellij's sbt plugin

The return type of (project in file(".")). enablePlugins(JettyPlugin) is Project. It is acceptable by sbt plugin.

However, if you use standalone enablePlugins(JettyPlugin), the return type is different, and it becomes DslEntry which makes the sbt plugin unhappy. Another way to workaround with that is simply to consume the return type of enablePlugins. For example:

val foo = enablePlugins(JettyPlugin)