Reputation: 1851
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)
Upvotes: 0
Views: 184
Reputation: 688
Universal / target := (Compile / target).value
Works for me. How I found this:
There is a useful tool in SBT to dive into settings and tasks: inspect
I ran inspect root/Universal/packageBin
(root/Universal/packageBin
is how we build an artifact), it returned:
... [info] Dependencies: [info] Universal / packageBin / validatePackage [info] Universal / packageBin / mappings [info] Universal / packageName [info] Universal / target [info] Universal / packageBin / universalArchiveOptions [info] Universal / topLevelDirectory ...
Universal / target
looked interesting, so I ran: inspect Universal / target
, it returned:
... [info] Description: [info] Main directory for files generated by the build. ...
We can find that Compile / target
returns a path to the target directory in a same way (or just a read docs).
Upvotes: 1