sbt-assembly
sbt-assembly copied to clipboard
Creating a Jar with conf files not working
I have been trying to create a Jar file with application.conf files inside the jar. But unfortunately, seems the .conf files are not being included in the final jar. Here is my BuildSettings.scala file:
object BuildSettings {
lazy val basicSettings = Seq[Setting[_]](
organization := "com.my.project",
version := "0.1.0-SNAPAHOT",
description := "sample preparation",
scalaVersion := "2.11.7",
scalacOptions := Seq("-deprecation", "-encoding", "utf8"),
resolvers ++= Dependencies.resolutionRepos
)
// sbt-assembly settings for building one fat jar
import sbtassembly.Plugin._
import AssemblyKeys._
lazy val sbtAssemblySettings = assemblySettings ++ Seq(
jarName in assembly := {
name.value + "-" + version.value + ".jar"
},
// META-INF discarding
mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
{
case "application.conf" => MergeStrategy.concat
case PathList("META-INF", xs @ _*) => MergeStrategy.discard
case x => MergeStrategy.first
}
}
)
lazy val buildSettings = basicSettings ++ sbtAssemblySettings
}
What should I do to include the conf folder? Here is my project structure:
MyProject -src
- main
- mypackages and source files
- conf // contains application.conf, application.test.conf and so on
- test -project // contains all the build related files
- README.md
Try place them under src/main/resources