你需要采取的步骤基本如下:
创建SBT任务,让您可以访问war文件
沟通战争文件的位置到代码
告诉码头文件的位置
注意,代码是未经测试,但它应该给你的东西去
1.
val warFile = taskKey[File]("A reference to the war file")
warFile := {
val filter = artifactFilter(name = "name of warfile")
val updateReport = update.value
updateReport.filter(filter).toSeq.headOption.map {
case (config, module, artifact, file) => file
}.getOrElse(sys.error("Could not find a warfile"))
}
2.
在project/buildinfo.sbt
添加addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.3.2")
buildInfoPackage := "your.package",
buildInfoObject := "BuildInfo",
buildInfoKeys := Seq[BuildInfoKey](
warFile
),
sourceGenerators in Compile <+= buildInfo
3.
val warFile = new File(BuildInfo.warFile)
// pass to Jetty
在你用sbt自动化之前,你知道如何用Jetty做这件事,并且自己去战斗(没有sbt)吗? – 2014-10-18 15:40:54