While you can filter these resources, I would suggest placing them in a different directory and adding them to the class path.
Changing the initial script generated by sbt-native-packager is a bit cumbersome since the class com.typesafe.sbt.packager.archetypes.JavaAppBashScript , which generates the class path, prefix all paths with $lib_dir/ . The cleanest approach would probably be to provide your own implementation and use it to generate bashScriptDefines .
A simple but hacky way would be to simply add the following lines to build.sbt :
packageArchetype.java_server // add your config files to the classpath for running inside sbt unmanagedClasspath in Compile += Attributed.blank(sourceDirectory.value/"main"/"config") // map all files in src/main/config to config in the packaged app mappings in Universal ++= { val configDir = sourceDirectory.value/"main"/"config" for { file <- (configDir ** AllPassFilter).get relative <- file.relativeTo(configDir.getParentFile) mapping = file -> relative.getPath } yield mapping } scriptClasspath ~= (cp => "../config" +: cp)
This will add $lib_dir/../config to the beginning of the script path. If your application should run on Windows, you will need to provide similar settings for batScriptDefines .
source share