java - log4j.properties gets overwritten when creating a "fat-JAR" using Gradle -
one of java projects exports executable "fat-jar" file ready deployment. creating jar file using gradle, followed instructions described here:
task fatjar(type: jar) { manifest { attributes 'implementation-title': '<human_readable_title_of_your_package>', 'implementation-version': version, 'main-class': '<path_to_the_main_application_class>' } basename = project.name + '-all' { configurations.compile.collect { it.isdirectory() ? : ziptree(it) } } jar }
the task illustrated recursively go through dependency tree, unzip jars if needed, , squash together. problem far of dependencies come own log4.properties
files, overwrite 1 have written myself. of them reside within same level respective resources folders
, when files merged together, later ones seem overwrite ones have been added before.
so far, solution have found, manually set path right file, using command-line parameter. able execute jar itself, without additional overhead.
what way keep log4.properties
, exclude others being added package?
you can exlude file collection of files merged build jar.
from { configurations.compile.collect { it.isdirectory() ? : ziptree(it) } } { exclude "dir/subdir/the_file_to.exclude". }
Comments
Post a Comment