I am using sbtassembly from https://github.com/sbt/sbt-assembly to package my project.
I'm wondering is there anyway to exclude the resource files?
I am using sbtassembly from https://github.com/sbt/sbt-assembly to package my project.
I'm wondering is there anyway to exclude the resource files?
You can specify files (and paths) to exclude by customizing the mergeStrategy
:
https://github.com/sbt/sbt-assembly#excluding-specific-files
So for discarding specific file you can do something like this:
// build.sbt
assemblyMergeStrategy in assembly := {
case PathList("about.html") => MergeStrategy.discard
case x =>
val oldStrategy = (assemblyMergeStrategy in assembly).value
oldStrategy(x)
}
Here's the documentaion for all available strategies: https://github.com/sbt/sbt-assembly#merge-strategy
Using Dani's approach with sbt
0.13.13, the config files were still included in my jar. This worked, though:
excludeFilter in Compile := "myconfig.conf",
In my case, all the files have the same name, myconfig.conf
, but exist within a tree structure under src/main/resources/config. I tried:
unmanagedResourceDirectories in Compile += { baseDirectory.value / "src/main/resources/config" },
But it removed the directories from the jar, leaving the files.
It's documented here: http://www.scala-sbt.org/0.13/docs/Howto-Customizing-Paths.html