'Visualizing dependency size via sbt assembly

I am using sbt assembly to package my project into one fat jar. I wanted to understand if I can visualize how much disk space is each dependency taking in my fat jar.



Solution 1:[1]

AFAIK there is no "magic" in SBT assembly, meaning the whole content of each dependency JAR is added to the fat JAR. For instance no "tree shaking" like in other languages to remove unused classes.

Thus, one way to get what you're looking for is to package your project without assembly and look at the lib directory: each JAR used in the production code will be present and you can get its size.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Gaël J