Tomy Tomy - 2 years ago 147
Java Question

Import only one dependency in Java Maven project

I need to make a jar out of my Java project, and I need it to also contain the class files of one of the dependencies, but not all of them. I've used

which includes all the files and creates a huge jar, but I only need


I've also tried the maven shade plugin but with no result: I somehow end up including all the dependencies or excluding all of them


Answer Source

Use 'provided' for the scope tag of the dependencies that you don't want to include in the final jar file.


And use maven-assembly-plugin to build the jar

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download