Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom outputPath for sbt-assembly

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?

like image 980
user2597851 Avatar asked Feb 15 '15 00:02

user2597851


People also ask

Can SBT run a JAR file created by SBT?

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.

How do I generate output from the build path?

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.

What is SBT-Assembly?

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.

How do I change the output path of a Visual Studio project?

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:


1 Answers

assemblyOutputPath in assembly := file("yourpath")
like image 133
randomsearch Avatar answered Oct 15 '22 21:10

randomsearch