gradlehoconshadowjar

gradle shadowJar combine configuration files in HOCON format


How can I combine application.con HOCON formatted files for lightben/typesafe configuration https://github.com/lightbend/config when creating a fat jar using gradle with the shadow plugin?

I.e. there are > 1 module which provide a application.conf file which need to be merged when creating a fat jar.

I would hope that something without additional code works i.e. that not a custom Transformer (https://imperceptiblethoughts.com/shadow/configuration/merging/) is required. There seems to exist one for XML https://github.com/johnrengelman/shadow/blob/f6ff6525c531b226f7faf44177ad5e6e7ef913b6/src/main/groovy/com/github/jengelman/gradle/plugins/shadow/transformers/XmlAppendingTransformer.groovy#L44 but not yet for HOCON


Solution

  • I think something like this Merging multiple TypeSafe Config files and resolving only after they are all merged but I am afraid you need to change your code.