Compressing akka-sbt-plugin output directories to single tar (possibly with sbt-native-packager)?

StackOverflow https://stackoverflow.com/questions/21450279

  •  04-10-2022
  •  | 
  •  

Question

My sbt file uses the akka-sbt-plugin to create the Akka microkernel in the target/<project>-dist directory. That directory has sub-directories bin, config, deploy and lib.

I would like to compress that directory into a single tarball.

I have attempted to use the sbt-native-packager with the Universal target but I do not understand how to make the mappings work.

Is sbt-native-packager the way to go? How do I reference the directory created by the akka-sbt-plugin? Is there a better way to compress the directory?

Update - adding more info

My plugins.sbt, among other things, has:

addSbtPlugin("com.typesafe.akka" % "akka-sbt-plugin" % "2.2.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "0.6.3")

To get the output from akka-sbt-plugin I use dist in sbt. That yields a directory full of useful things in target/myproject-dist. I want to compress that directory into a single tarball (and somehow understand how to link the command onto the output of akka-sbt-plugin because I understand that's a best practice.)

Was it helpful?

Solution

A sample of build.sbt with sbt-native-packager:

import com.typesafe.sbt.packager.Keys._
import com.typesafe.sbt.SbtNativePackager._

packageArchetype.java_application

mappings in Universal ++= {
  ((file("src/main/resources") * "*").get map { f => f -> ("conf/" + f.name) }) ++
  ((file("bin") * "*").get map { f => f -> ("bin/" + f.name) })
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top