Reputation: 121
I am a novice to sbt and I would like to include a custom folder into final package. Based on some good reads, I understand sbt follows a specific folder structure and doesn't include custom folders unless specified in build file.
Following is the project folder structure and would like to include bin and subsequent files into the end package, but this doesn't seem to work for me. Any inputs appreciated
LICENSE README.MD app/ build.sbt conf/ lib/ project/ public/ bin/
Section i tried in the sbt build file
import com.typesafe.sbt.SbtNativePackager.Universal
mappings in Universal += {
file("bin") -> "bin"
}
Upvotes: 6
Views: 2817
Reputation: 3641
The MappingsHelper object is exactly what you need. Basically it's a better API for SBTs PathFinder.
import com.typesafe.sbt.SbtNativePackager.autoImport.NativePackagerHelper._
// without top level dir
mappings in Universal ++= contentOf(baseDirectory.value / "bin")
// with top level dir
mappings in Universal ++= directory(baseDirectory.value / "bin")
Update Since sbt 1.2.x these helpers are in the sbt Io package and available without sbt native packager as well.
Cheers, Muki
Upvotes: 7
Reputation: 121
This worked for me :-) Reference: How to add custom directory to Scala SBT project?
mappings in Universal ++= (baseDirectory.value / "bin" * "*" get) map(x => x -> ("bin/" + x.getName))
Upvotes: 1