11

I get the message Expression type DslEntry must conform to Def.SettingsDefinition in SBT file at line enablePlugins(JavaServerAppPackaging) i tried refreshing the project but it didn't help. The whole sbt file is mostly generated by the lightbend (former typesafe) activator and looks as follows

import NativePackagerHelper._

name := """ping-backend"""

version := "2.4.0"

scalaVersion := "2.11.7"

libraryDependencies ++= Seq(
  "com.typesafe.akka" %% "akka-actor" % "2.4.0",
  "com.typesafe.play" %% "play-json" % "2.4.6",
  "org.igniterealtime.smack" % "smack-java7" % "4.1.0",
  "org.igniterealtime.smack" % "smack-tcp" % "4.1.0",
  "org.igniterealtime.smack" % "smack-im" % "4.1.0",
  "org.igniterealtime.smack" % "smack-extensions" % "4.1.0"
)

enablePlugins(JavaServerAppPackaging)

mainClass in Compile := Some("sample.hello.Main")

mappings in Universal ++= {
  // optional example illustrating how to copy additional directory
  directory("scripts") ++
  // copy configuration files to config directory
  contentOf("src/main/resources").toMap.mapValues("config/" + _)
}

// add 'config' directory first in the classpath of the start script,
// an alternative is to set the config file locations via CLI parameters
// when starting the application
scriptClasspath := Seq("../config/") ++ scriptClasspath.value

when running activator run or sbt run in the command line the project runs. I can even build and run it from Intellij, so this is more of an inconvenience then an error, but I would still rather have it resolved. Can someone help me with this?

Lukasz
  • 2,257
  • 3
  • 26
  • 44
  • Possible duplicate of [Intellij sbt sbt-native-packager and enablePlugins error](http://stackoverflow.com/questions/31552605/intellij-sbt-sbt-native-packager-and-enableplugins-error) – Justin Kaeser Oct 06 '16 at 13:24
  • 1
    Still around in 2021, and there's no light at the end of the tunnel. Their QA dept should have been sacked long ago (I've talked to them several times, and they are clueless). – rapt Dec 18 '20 at 10:42

2 Answers2

7

I closed project by File -> close project option and removed all project/, target/ and .idea/ from main and sub projects. Then, I reopened intelliJ and made a fresh import by File -> New -> Project from existing sources -> import project from external model -> select project directory -> sbt.

I believe the issue happened for wrong way of import. Correct way of import fixed it.

Niladri
  • 93
  • 1
  • 6
1

The error comes from intellij's sbt plugin https://github.com/JetBrains/intellij-sbt/blob/master/idea-plugin/src/main/scala/org/jetbrains/sbt/language/SbtAnnotator.scala#L41.

try this

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

or this

val foo = disablePlugins(JavaServerAppPackaging)
comonad
  • 5,134
  • 2
  • 33
  • 31