How do I copy configuration files as part of a package for use in a deployment?
I am using sbt 0.13.5 to create a project with multiple config files intended for human editing after deployment.
Using the sbt-native-packager stage
command creates a basic output directory structure for deployment. This creates a folder bin
with the start of the script and all my jars in the folder lib
. Fine.
This just leaves the text config files to be copied to the folder conf
verbatim in folders bin/
and lib/
(not included in any jar).
How can I copy these config files to an output directory on the filesystem (not any jars) using sbt?
source to share
I'm not sure if there is out-of-the-box support for a directory src/main/conf
or similar, and if you don't find one, use the following as a workaround:
packageArchetype.java_application
mappings in Universal ++= {
((sourceDirectory in Compile).value / "conf" * "*").get.map { f =>
f -> s"conf/${f.name}"
}
}
It displays files in a directory src/main/conf
in conf
a package.
NB: I'm pretty sure I maintained the code for the directory somewhere conf
.
source to share
This seems to be the best answer as I am using sbt along with the sbt-native-packager plugin:
mappings in Universal ++= contentOf( baseDirectory.value / "conf" )
This takes all the files in the specified "conf" folder and dumps them into the root folder of the package.
Which is what the MappingsHelper uses , which I came across a very short documentation for it in sbt-native-packager,
source to share