When the servlet container is started using xsbt-web-plugin, it adds the context for <root dir>/target/webapp
. I have a multiproject set up where the web app is a subproject. How is the context added for a subproject instead of the root project?
Asked
Active
Viewed 89 times
0

Sledge
- 178
- 13
1 Answers
1
In a multi-module sbt project where xsbt-web-plugin is added to one of the submodules, the webapp
directory will be created under <project>/<submodule>/target/webapp
.
An example multi-module project can be found in the scripted tests directory. In this example, the project is called multi-module-single-webapp
, and the Web submodule is called mathsweb
, so the webapp
directory can be found under multi-module-single-webapp/mathsweb/target/webapp
.
To have sbt show you the full path of the webapp
directory, you can run show webappPrepare
at the sbt prompt:
sbt:root> show webappPrepare
...
[info] * (/home/james/code/multi-module-single-webapp/mathsweb/target/webapp,)
...
You can optionally specify the Web submodule name:
sbt:root> show mathsweb/webappPrepare
...
[info] * (/home/james/code/multi-module-single-webapp/mathsweb/target/webapp,)
...

earldouglas
- 13,265
- 5
- 41
- 50
-
Thanks! Is it possible to do this with only the root project having a build.sbt? – Sledge Mar 20 '18 at 04:24
-
1Looks like I can: https://www.scala-sbt.org/1.x/docs/Using-Plugins.html – Sledge Mar 20 '18 at 13:47
-
Yes, you can configure all modules/projects in the root project's build.sbt and plugins.sbt: https://www.scala-sbt.org/1.x/docs/Multi-Project.html – earldouglas Mar 20 '18 at 17:21