Christopher Helck
Christopher Helck

Reputation: 1140

Intellij sbt sbt-native-packager and enablePlugins error

I have an sbt build that works when I run from the command line, but that Intellij does not like. My Intellij is running on Linux, its version is 14.1.4, my scala plugin is 1.5.2.

Intellij complains about my use of enablePlugins(JavaAppPackaging). The error is "Expression Type (DslEntry) must conform to Setting[_] in SBT file".

My project/build.properties file:

sbt.version=0.13.8

My project/plugins.sbt

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.3")

And the first few lines of my build.sbt

enablePlugins(JavaAppPackaging)

organization := "org.bodhi"

name := "jar-patch"

version := "1.0"

Upvotes: 18

Views: 6538

Answers (4)

Justin Kaeser
Justin Kaeser

Reputation: 5948

The issue is due to how IntelliJ IDEA marks syntax errors, which may mark valid code red. This particular error will be fixed soon.

Upvotes: 0

murmelssonic
murmelssonic

Reputation: 91

The answer by @lifeGoGoGo on another thread Intellij IDEA and SBT syntax error works for me (on Ubuntu, setting the custom sbt-launcher.jar in global settings and project settings of IntelliJ IDEA - as sensibly answered by @Mustafa on this thread - wasn't enough, but then adding the "lazy val" tactic was enough). So for example, this worked for me in build.sbt (obviously you change your plugin-details to suit what you are doing, as this issue is caused by IntelliJ and not by the specific plugin you want to enable):

lazy val root = (project in file(".")).
  enablePlugins(ScalaJSPlugin).
  settings(
    name := "Scala.js Tutorial",
    scalaVersion := "2.11.7",
    version := "1.0"
  )

Upvotes: 3

califano
califano

Reputation: 1

@karol: I had the same problem. I solved by choosing again at the moment of opening the project /usr/share/sbt-launcher-packaging/bin/sbt-launcher.jar in "Import Project from SBT" -> Global SBT settings.

Upvotes: 0

Mustafa
Mustafa

Reputation: 2487

IntelliJ uses a bundled SBT launcher which might be a different version than what you are running in the command line.

Since you already know that command line SBT works, you may point IntelliJ to use the command line SBT instead of the bundled one.

  1. Go to settings page for SBT at Settings -> Build, Execution, Deployment -> Build Tools -> SBT.
  2. In the launcher section, choose Custom and point to the SBT launcher installed in the OS. In Ubuntu, the default location is /usr/share/sbt-launcher-packaging/bin/sbt-launcher.jar

Upvotes: 2

Related Questions