Expression type DslEntry must conform to Def.Setti

2019-02-09 04:05发布

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?

2条回答
聊天终结者
2楼-- · 2019-02-09 04:48

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)
查看更多
等我变得足够好
3楼-- · 2019-02-09 04:49

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.

查看更多
登录 后发表回答