Recently, i wanted to create a single Jar file with all the dependencies while the property files are excluded which are coming from the project. But the property files which are coming from dependencies should be preserved. My idea was to externalize property file so that someone can edit them without going inside Jar.
Following is example pom.xml. There you can see how i have used Maven Shade Plugin with property file excluding configurations. Shade plugin can be use to filter any file file from any dependent module conveniently.
Since i wanted an executable Jar i have specially used ManifestResourceTransformer in the Shade configurations.
I tried several options.
1. Using Maven Resources Plugin
Resources plugin perfectly work for the need. But it excludes the property files even when i run the project from the IDE (Eclipse/NetBeans)
2. Using Maven Assembly Plugin
I tried jar-with-dependencies pre-defined assembly descriptor with few customization. I used exclusion in unpackOptions. But it excludes property files which are coming from all the dependent modules.
Finally i found the working solution. It was Maven Shade Plugin
Since i wanted an executable Jar i have specially used ManifestResourceTransformer in the Shade configurations.