Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rename assembly-generated uberjar in SBT

How to rename and move an uberjar generated with SBT assembly plugin?

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6")

My assemblyMergeStrategy(for META-INF removal):

assemblyMergeStrategy in assembly := {
   case PathList("META-INF", xs @ _*) => MergeStrategy.discard
   case x => MergeStrategy.first
}

It generates something like :

target/scala-2.12/my-project-assembly-0.1.jar 

which I would like to able to automatically rename (and generate in another directory) with a consistent name (without the need of a separate script).

like image 678
xmar Avatar asked Oct 17 '25 16:10

xmar


1 Answers

You can find a bit of documentation in project's page. There, you can find the keys you can rewrite for the assembly task.

The ones you are searching for are assemblyJarName and assemblyOutputPath. Then, your project build should look something like:

lazy val myProject = (project in file(".")).
  settings(
    ...
    assemblyJarName in assembly := "myName.jar",
    assemblyOutputPath in assembly := "...",
    ...
  )
like image 110
Miguel Avatar answered Oct 20 '25 06:10

Miguel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!