I am creating a Jar using the following Gradle task (very new here, so mistakes are possible):
task fatJar(type: Jar) {
manifest {
attributes 'Implementation-Title': 'Gradle Jar File Example',
'Implementation-Version': version,
'Main-Class': 'EntryPoint',
'Class-Path': configurations.runtimeClasspath.files.collect { it.getName() }.join(' ')
exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
}
baseName = project.name
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } }
with jar
}
This packs all my configuration files neatly into the Jar. What I want to do is add an external directory to the classpath (ideally, this would be the very folder the Jar is located in), which could (but may not) contain configuration files with values different from those in the jar. If that directory is not empty, I want my code to use the files inside it. If it is, or if there is some other issue, I would want it to revert to the config files inside the Jar. How can I achieve this?