3

Is there a way in sbt-native-packager to split a fat jar into multiple jars? Ideally one for the dependencies, another for assets, and a third for the code? I am trying to optimize docker layering by splitting the seldom changed assets and dependencies into their own docker layers and leaving the code in its own separate layer. This way when only the code changes, I do not have to push the additional layers for the unchanged dependencies and assets. It would only change the code layer.

I assume sbt assembly could do this easily, but I am wondering if there are other ways about this. I know there has also been some work done towards porting Jib to SBT as well, as Jib does this technique of splitting the dependencies. You can see a Jib based example of what I am trying to achieve here: https://phauer.com/2019/no-fat-jar-in-docker-image/

Thanks!

Chris Marsh
  • 67
  • 1
  • 8
  • I've done it for ZIP archives, you should easily tweak it for jars: https://stackoverflow.com/questions/58732442/how-to-package-my-application-as-multiple-archives – YSC Nov 21 '19 at 13:28
  • There is an ongoing work in sbt native packager: https://github.com/sbt/sbt-native-packager/pull/1268 – Muki Nov 23 '19 at 12:22

0 Answers0