1

I would like to use Maven to download a "fat" jar- one that includes all of its dependencies. (The same sort of jar that is built using the jar-with-dependencies descriptor Ref in the maven-assembly-plugin)

The default behavior of mvn dependency:copy is to download the jar and all of its dependencies in separate files. This is not what I want. I want the dependencies to be included in the jar itself.

How do I achieve this using Maven? If it's not possible, is there some sort of manual way of assembling the fat jar myself given all its dependency JARs?

mario_sunny
  • 1,412
  • 11
  • 29
  • I'm a little confused by your question. You mentioned the `maven-assembly-plugin` which does exactly what you described; it builds a *fat* JAR containing the shaded dependencies. – Jacob G. Feb 26 '19 at 18:20
  • @JacobG I need to download a fat jar from a Maven repository, not assemble one. – mario_sunny Feb 26 '19 at 18:22
  • 1
    So you're saying that, when you download a JAR from Maven Central, it doesn't contain its shaded dependencies? – Jacob G. Feb 26 '19 at 18:24
  • @JacobG. I am not using Maven Central; it is an internal company Maven repository. But yes, it does not contain any dependencies. Is that not normal? – mario_sunny Feb 26 '19 at 18:29
  • Actually, it seems like you are doing something wrong, because I cannot think of any legitimate use-case for such a fat jar. Can you explain to me what you are trying to achieve? – J Fabian Meier Feb 26 '19 at 19:49

0 Answers0