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?
A JAR file created by SBT can be run by the Scala interpreter, but not the Java interpreter. This is because class files in the JAR file created by sbt package have dependencies on Scala class files (Scala libraries), which aren’t included in the JAR file SBT generates. This is easily demonstrated. First, create an empty SBT project directory.
Type in the path to generate output to (absolute or relative to the root project directory), or choose Browse to browse to that folder instead. Some projects will by default include framework and runtime in the build path.
sbt-assembly is a sbt plugin originally ported from codahale's assembly-sbt, which I'm guessing was inspired by Maven's assembly plugin. The goal is simple: Create a über JAR of your project with all of its dependencies. The burning desire to have a simple deploy procedure.
For Visual Basic, select the Compile tab. For C++ or JavaScript, select the General tab. In the configuration drop-down at the top, choose the configuration whose output file location you want to change ( Debug, Release, or All Configurations ). Find the output path entry on the page—it differs depending on your project type:
assemblyOutputPath in assembly := file("yourpath")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With