Maven assembly plugin exclude a file from a particular dependency

717 views Asked by At

I have a file in two dependencies and I want to merge both of them, so I have placed a merged file in resources folder, Now I want to exclude those two files from dependencies and include the one from resources folder. While searching for solution I have found a lot of answers related to maven shade plugin, but when I try that I get the following error:

Exception in thread "main" java.lang.SecurityException: Invalid signature file digest for Manifest main attributes
    at sun.security.util.SignatureFileVerifier.processImpl(SignatureFileVerifier.java:287)
    at sun.security.util.SignatureFileVerifier.process(SignatureFileVerifier.java:240)
1

There are 1 answers

1
vincent On

I don't know if it's possible for you but, in my opinion one way to do it would be to unpack the dependencies and excludes the files you don't want.

For that you can use the maven assembly plugin with the unpack or unpack-dependencies goals.

https://maven.apache.org/plugins/maven-assembly-plugin/unpack-mojo.html and you could base your search on this thread i think Excluding packages from jars in maven assembly descriptor