sbt-assembly: How do I include the static files in src/main/webapp
Asked Answered
B

1

5

I am using sbtassembly from https://github.com/sbt/sbt-assembly with this merge strategy:

mergeStrategy in assembly <<= (mergeStrategy in assembly) { (old) =>
  {
    case PathList("javax", "servlet", xs @ _*)         => MergeStrategy.first
    case PathList(ps @ _*) if ps.last endsWith ".html" => MergeStrategy.first
    case "application.conf" => MergeStrategy.concat
    case "unwanted.txt"     => MergeStrategy.discard
    case x => old(x)
  }
}

For some reason my static content is not being included in the executable jar, but my webservices work fine (so it does work).

How can I include my index.html and javascript files?

Bronchial answered 21/10, 2013 at 19:19 Comment(1)
B
12

There's a related question Why sbt compile doesn't copy unmanaged resources to classpath? that you can get an idea for the setting.

Here's the setting using sbt 0.13:

unmanagedResourceDirectories in Compile += { baseDirectory.value / "src/main/webapp" }
Bullroarer answered 21/10, 2013 at 21:54 Comment(2)
Thank you. I was assuming it was an sbtassembly problem. Tomorrow I will test if it was an sbt issue.Bronchial
You put me on the correct path, I ended up succeeding with: resourceDirectory in Compile <<= baseDirectory(_ / "src/main/webapp")Bronchial

© 2022 - 2024 — McMap. All rights reserved.