Simple build tool (SBT) package WAR

2019-05-23 02:36发布

问题:

I have a multiple project configuration. One of the projects needs to be build as a war file for future deployment. I used this sbt-plugin: https://github.com/JamesEarlDouglas/xsbt-web-plugin to build the war. However I need it to include depended projects as jars.

In maven I included other modules as a dependency in my WAR module and they appeared eventually in the WAR:lib directory. It seems that sbt-web-plugin default behavior is not to include them

What I mean is: This is a part of my parent.scala file

lazy val dataPopulator = Project(
"data-populator",
    file("data-populator"),
    settings = buildSettings ++ Seq (libraryDependencies ++= dataPopulatorDeps)) 

lazy val warProject = Project(id = "rest-ws",
    base = file("rest-ws"),
    settings = buildSettings ++ Seq (libraryDependencies)) dependsOn(dataPopulator)

The dataPopulator Project above when packaged creates a jar. The warProject Project above have a specific build.sbt in it's directory rest-ws/build.sbt:

seq(webSettings :_*)

name := "main-ws"

libraryDependencies += "org.mortbay.jetty" % "jetty" % "6.1.22" % "container"

When I run the package command (added by the web plugin) it creates a war, the problem is that this war doesn't include dataPopulator jar while it depends on it during compile time.

Anyone have a suggestion how to include generated jar artifacts from some modules into another project that is packaged as war ?

标签: scala jar war sbt