scalasbtwarxsbt-web-plugin

How to include per Project Jar file with xsbt-web-plugin / merge application.conf?


I just switched from maven to sbt for a Scala build. Since part of the builds are also war files, I use xsbt-web-plugin to create war files with sbt. Everything works fine, except an issue with the outputted WAR.

The WAR dependsOn two other sub projects (transitively). When I run package the classes and resources of the other sub projects are both merged and copied. Which also means that the application.conf is overwritten by the most recently defined dependsOn and not merged.

How this is solved by maven is that it includes every dependency as a JAR file in the WEB-INF/lib, however this is due to that maven has no mechanism like dependsOn vs libraryDependencies.

How can this be solved with xsbt-web-plugin? By using a merge strategy like OneJar or do I have to split the WAR build from the other build and define them as dependencies.


Solution

  • OK, figured it out with some more searching, https://github.com/earldouglas/xsbt-web-plugin/issues/111 gave the right hint.

    Set exportJars := true for the dependsOn modules.