我已通过 SBT 项目配置为使用 xsbt-web-plugin 进行 Web 部署。描述这一点的文档似乎是:
这是我迄今为止根据阅读文档所做的:
我创建了 plugins.sbt :
resolvers += "Web plugin repo" at "http://siasia.github.com/maven2"
addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "0.9.0")
在 build.sbt 中添加了以下几行:
Seq(webSettings :_*)
// disable .jar publishing
publishArtifact in (Compile, packageBin) := false
// create an Artifact for publishing the .war file
artifact in (Compile, packageWar) := {
val previous: Artifact = (artifact in (Compile, packageWar)).value
previous.copy(`type` = "war", extension = "war")
}
// add the .war file to what gets published
addArtifact(artifact in (Compile, packageWar), packageWar)
使用sbt加载项目时,插件被下载,但随后报以下错误:
[error] Reference to undefined setting:
[error]
[error] *:packageWar from *:$local (W:\Tempi\TempiJetty\build.sbt:48)
[error] Did you mean compile:packageWar ?
写compile:packageWar
而不是packageWar
最后一行会导致不同的错误:
[info] Loading project definition from W:\Tempi\TempiJetty\project
W:\Tempi\TempiJetty\build.sbt:48: error: not found: type packageWar
addArtifact(artifact in (Compile, packageWar), compile:packageWar)
^
[error] Type error in expression
我应该写什么才能让我的 SBT 项目支持战争打包?