简体   繁体   中英

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

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?

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" }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM