你需要採取的步驟基本如下:
創建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