@Kelsey Gilmore-Innis 有正确的答案,但既然它不被接受,我们就打破它,打破它,打破它。
首先,我假设您正在关注 Getting started guide 以使用 g8 安装 Scalatra。希望和我刚得到的版本相同。
g8 scalatra/scalatra-sbt
g8 模板所做的是设置使用 scalatra-sbt 0.3.2 插件的 sbt 0.13 构建:
addSbtPlugin("org.scalatra.sbt" % "scalatra-sbt" % "0.3.2")
这个插件内部使用JamesEarlDouglas/xsbt-web-plugin0.4.0 做webapp相关的设置。
xsbt-web-plugin 0.4.0
这就是为什么 xsbt-web-plugin 变得相关的原因,即使您只是想更改 Scalatra 的设置。您需要重新接线的设置称为webappResources in Compile。它是如何工作的?
重新连接 webappResources
要重新连接设置,请打开 project/build.scala。添加
import com.earldouglas.xsbtwebplugin.PluginKeys.webappResources
导入子句。然后更改设置如下:
lazy val project = Project (
"foo",
file("."),
settings = Defaults.defaultSettings ++ ScalatraPlugin.scalatraWithJRebel ++ scalateSettings ++ Seq(
organization := Organization,
name := Name,
version := Version,
scalaVersion := ScalaVersion,
resolvers += Classpaths.typesafeReleases,
webappResources in Compile := Seq(baseDirectory.value / "content" / "doc-root"),
...
)
)
现在将 src/main/webapp 移动到 content/doc-root,重新加载 sbt,就可以了。