I have an sbt project with custom env configuration.
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"}
)): _*)
So when I run sbt Local/compile
or sbt Local/run
command I see in the target directory my compiled classes with my Local configuration.
Then I add xsbt-web-plugin for packaging .war
file
addSbtPlugin("com.earldouglas" % "xsbt-web-plugin" % "4.2.4")
And in build.sbt
enablePlugins(WarPlugin)
Now I try to run sbt Local/package
command and get just .jar
but not .war
If I run sbt package
command I get .jar
and .war
files but without my Local configuration.
Help me, please. How can I make sbt Local/package
work correct?
Or maybe you know some other way to build .war
file with sbt.