Fat Jar generation
I need a help with generating fatJar . I have the following code which generates the fatJar
jar {
archiveFileName = 'myjar.jar'
zip64 = true
manifest {
attributes 'Main-Class': 'Main Class'
}
}
task fatJar(type: Jar) {
manifest {
attributes 'Main-Class': 'Main Class'
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveFileName = 'fat.jar'
zip64 = true
from {
configurations.runtimeClasspath.collect {
it.isDirectory() ? it : zipTree(it)
}
}
with jar
exclude 'META-INF/*.RSA'
exclude 'META-INF/*.SF'
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.txt'
}
The fatJar generation works fine. However I need help with excluding certain resource files. Currently if one if the included files has a resource matching with my resource file, the resource file from the library is getting included instead of my resource file. For eg: if there is a library xyz.jar with the following structure
xyz.jar file
src/main/java
library class files
src/main/resources
config.yaml
My project structure
src/main/java
my class files
src/main/resources
config.yaml
In this case the config.yaml file from xyz.jar file is getting included. But what I want is to have the file from my project to get included.
Kindly guide me on how to exclude the resource file from the included library and use my resource files.