Reputation: 131
I have multi-project Build.scala
. Is there a way to place all jars generated by sbt-assembly in the root target directory?
For example, consider the following:
lazy val root = Project("root", file(".")).aggregate(hello)
lazy val hello = Project(id = "hello", base = file("hello"))
.settings(assemblySettings: _*)
As is, if I run sbt assembly
, hello.jar
would be placed in hello/target/<scala-version>/
. Is possible instead to place it in /target/<scala-version>/
?
I know it's possible to specify the outputPath I want by adding the following setting:
target in assembly := file("target/scala-2.11/")
Is there any way to make this more generic? For example, so it is not necessary to manually specify the scala version?
Upvotes: 13
Views: 7467
Reputation: 460
A small improvement on this answer. If you need to retain the file name that is generated by assembly plugin do it as below:
assembly / assemblyOutputPath := file(s"/path/to/jar/${(assembly/assemblyJarName).value}")
Upvotes: 3
Reputation: 31
You can set assemblyOutputPath
via cmd:
sbt 'set assemblyOutputPath in assembly := new File("/path/to/package.jar")' assembly
In case you need to set multiple options - just use spaces:
sbt 'set test in assembly := {}' 'set assemblyOutputPath in assembly := new File("/path/to/package.jar")' assembly
Upvotes: 0