This is my build.sbt:
name := "DB-Services"
version := "0.1"
scalaVersion := "2.12.12"
lazy val root = (project in file(".")).enablePlugins(UniversalPlugin,JavaServerAppPackaging)
artifactName := { (_, _, _) => "DB-Services.zip"}
Universal / mappings ++= directory(target.value)
Currently sbt package generates DB-Services.zip inside of target/scala-2.12. However I need this ZIP to be generated inside target folder instead. But the problem is that the mapping I provided above does not work and the ZIP continues to be generated inside target/scala-2.12.
What changes should I do in my build.sbt so that the ZIP is generated in target folder? (I cannot generate the ZIP in any other location due to limitations with our CICD)
(PS: This answer does not work, so please do not mark this as duplicate)
Works for me. How I found this:
There is a useful tool in SBT to dive into settings and tasks:
inspectI ran
inspect root/Universal/packageBin(root/Universal/packageBinis how we build an artifact), it returned:Universal / targetlooked interesting, so I ran:inspect Universal / target, it returned:We can find that
Compile / targetreturns a path to the target directory in a same way (or just a read docs).