我已经通过SBT项目配置使用xsbt-web-plugin进行Web部署。描述这个的文档似乎是:
这是我到目前为止基于阅读文档所做的工作:
我用:
创建了plugins.sbtresolvers += "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项目支持战争包装?
答案 0 :(得分:0)
即使删除最后一行addArtifact(artifact in (Compile, packageWar), packageWar)
,package
中的sbt
命令仍构建war
文件。这可能是新的或特定于我正在使用的SBT 0.13(文档似乎更旧),或者也许意图是使用编译命令打包war文件,我不需要。