java – Can I add libraries inside the Jar file?


Java project uses third-party libraries, I connect them as maven dependencies through IDEA .

When starting the build, the assembled app.jar and the lib folder with libraries appear in target . These libraries are spelled out in the manifest.

Can I stuff these libraries inside my app.jar ?


In general, there are at least two plugins that allow you to build a jar file with dependencies.

They are Maven Shade plugin and Maven Assembly plugin . How to use each of these plugins can be found on the links to the official documentation. There is also a detailed description of when, which one to use (for me they are in most cases equivalent, but sometimes one of them is better).

Scroll to Top