I have a scala project that uses the ConfigFactory
to set up the application configurations. For building I use sbt
(together with sbt-assembly
).
Depending on whether I create an assembly with sbt-assembly
or whether I just run the project, I would like to use different config files (application.conf
when running the project, assembly.conf
when running the assembly of the project).
I thought of using the assemblyMergeStrategy
for this purpose: When assembling the jar, I would discard the application.conf
and rename assembly.conf
. My idea was something like:
assemblyMergeStrategy in assembly := {
case PathList("application.conf") => MergeStrategy.discard
case PathList("assembly.conf") => MergeStrategy.rename
...
}
By this I would like to achieve is that when assembling the jar, the file assembly.conf
is renamed to application.conf
and is therefore used by ConfigFactory
, whereas the original application.conf
is discarded.
The code above obviously does not work, as I cannot specify to what filename assembly.conf
should be renamed to. How can I achieve this?