使用sbt构建Scala项目时找不到SbtWeb

时间:2017-11-01 16:13:55

标签: scala intellij-idea sbt

我正在尝试在我的项目中使用https://github.com/dispalt/sbt-reactjs插件。 README中有一条指令用于启用插件SbtWeb。我在project/build.sbt

中这样做了
lazy val root = (project in file("."))
   .settings(
     name := "fooapp",
     version := "0.1",
     scalaVersion := "2.12.4"
   )
   .enablePlugins(SbtWeb)

我的project/plugins.sbt看起来像这样:

resolvers ++= Seq(
  "Typesafe Releases Repository" at "http://repo.typesafe.com/typesafe/releases/",
  "Local Maven Repository" at "file://"+Path.userHome.absolutePath+"/.m2/repository",
  Resolver.sonatypeRepo("public")
)

addSbtPlugin("com.github.ddispaltro" % "sbt-reactjs" % "0.6.8")
addSbtPlugin("com.typesafe.sbt" % "sbt-web" % "1.2.0")

虽然一切看起来都是正确的,但在构建IntelliJ IDEA时出现此错误:

Error:Error while importing SBT project:<br/><pre>
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=384M; support was removed in 8.0
/fooapp/project/build.sbt:7: error: not found: value SbtWeb
.enablePlugins(SbtWeb)
^
sbt.compiler.EvalException: Type error in expression
[error] sbt.compiler.EvalException: Type error in expression
[error] Use 'last' for the full log.
Invalid response.</pre>

我做错了什么? (我使用的是通过build.properties设置的sbt 0.13.16)

1 个答案:

答案 0 :(得分:1)

project/build.sbt中的内容应该在./build.sbt(项目的根目录)中。阅读有关project structure

的sbt文档
build.sbt
project/
  build.properties
  plugins.sbt