我有一个带有自定义环境配置的 sbt 项目。
val Prod = config("prod") extend Compile describedAs "Scope to build production packages."
val Stage = config("stage") extend Compile describedAs "Scope to build stage packages."
val Local = config("local") extend Compile describedAs "Scope to build local packages."
lazy val root = (project in file("."))
.configs(Prod, Stage, Local)
.enablePlugins(WarPlugin)
.settings(
name := "pet",
dependencySettings
).
settings(inConfig(Prod)(Classpaths.configSettings ++
Defaults.configTasks ++ Defaults.resourceConfigPaths ++ Seq(
unmanagedResourceDirectories += {baseDirectory.value / "src" / "main" / configuration.value.name / "resources"}
)): _*).
settings(inConfig(Stage)(Classpaths.configSettings ++
Defaults.configTasks ++ Defaults.resourceConfigPaths ++ Seq(
unmanagedResourceDirectories += {baseDirectory.value / "src" / "main" / configuration.value.name / "resources"}
)): _*).
settings(inConfig(Local)(Classpaths.configSettings ++
Defaults.configTasks ++ Defaults.resourceConfigPaths ++ Seq(
unmanagedResourceDirectories += {baseDirectory.value / "src" / "main" / configuration.value.name / "resources"}
)): _*)
因此,当我运行sbt Local/compile
或sbt Local/run
命令时,我会在目标目录中看到带有本地配置的编译类。
然后我为打包文件添加xsbt-web-plugin.war
addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "4.2.4")
而在build.sbt
enablePlugins(WarPlugin)
现在我尝试运行sbt Local/package
命令并得到只是.jar
但不是.war
如果我运行sbt package
命令,我会得到.jar
和.war
文件,但没有我的本地配置。
请帮帮我。我怎样才能使sbt Local/package
工作正确?.war
或者,也许您知道使用 sbt 构建文件的其他方法。