Intellij sbt sbt-native-packager 和 enablePlugins 错误 [英] Intellij sbt sbt-native-packager and enablePlugins error
问题描述
当我从命令行运行时,我有一个 sbt 构建,但 Intellij 不喜欢它.我的 Intellij 在 Linux 上运行,它的版本是 14.1.4,我的 scala 插件是 1.5.2.
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 抱怨我使用 enablePlugins(JavaAppPackaging).错误是表达式类型(DslEntry)必须符合 SBT 文件中的设置 [_]".
Intellij complains about my use of enablePlugins(JavaAppPackaging). The error is "Expression Type (DslEntry) must conform to Setting[_] in SBT file".
我的项目/build.properties 文件:
My project/build.properties file:
sbt.version=0.13.8
我的项目/plugins.sbt
My project/plugins.sbt
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.3")
还有我的 build.sbt 的前几行
And the first few lines of my build.sbt
enablePlugins(JavaAppPackaging)
organization := "org.bodhi"
name := "jar-patch"
version := "1.0"
推荐答案
@lifeGoGoGo 在另一个线程上的答案 Intellij IDEA 和 SBT 语法错误 对我有用(在 Ubuntu 上,在 IntelliJ IDEA 的全局设置和项目设置中设置自定义 sbt-launcher.jar - 正如@Mustafa 明智地回答在这个线程上 - 还不够,但是添加lazy val"策略就足够了).因此,例如,这在 build.sbt 中对我有用(显然您更改了插件详细信息以适应您正在做的事情,因为此问题是由 IntelliJ 引起的,而不是由您要启用的特定插件引起的):
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"
)
这篇关于Intellij sbt sbt-native-packager 和 enablePlugins 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!