Harold Ibouanga
Harold Ibouanga

Reputation: 563

Size difference between Maven generated JAR file vs Eclipse export JAR file

I've noticed something strange while using maven. When exporting my Java project with eclipse and compare the file size with the one generated with maven-jar-plugin or maven-assembly, the last one looks more fat, sometimes, 2 times the size of the first.

Anyone have an idea of this size difference?

Upvotes: 0

Views: 419

Answers (1)

rzwitserloot
rzwitserloot

Reputation: 103018

jar tvf thatjar.jar prints the names and sizes of all files inside. Then just compare the two and you'll know what's going on. Alternatively, just fetch any zip tool, such as 7-zip and open those jar files (at least as far as looking at them / unpacking them is concerned, they are ZIP files. Creating them with non-jar-aware tools is a bit tricky though, don't do that. But looking/reading with zip tools like 7zip works great).

Most likely culprit is that your maven-assembly plugin is striping the deps in, and eclipse isn't.

Upvotes: 1

Related Questions