Web 应用程序子项目

Web App Subproject

当使用 xsbt-web-plugin 启动 servlet 容器时,它会添加 <root dir>/target/webapp 的上下文。我设置了一个多项目,其中 Web 应用程序是一个子项目。如何为子项目而不是根项目添加上下文?

在 multi-module sbt 项目中 xsbt-web-plugin 添加到子模块之一,webapp 目录将在 <project>/<submodule>/target/webapp.

下创建

可以在脚本测试目录中找到 example multi-module project。在本例中,项目名为multi-module-single-webapp,Web子模块名为mathsweb,因此webapp目录可以在multi-module-single-webapp/mathsweb/target/webapp.

下找到

要让 sbt 显示 webapp 目录的完整路径,您可以 运行 show webappPrepare 在 sbt 提示符下:

sbt:root> show webappPrepare
...
[info] * (/home/james/code/multi-module-single-webapp/mathsweb/target/webapp,)
...

您可以选择指定 Web 子模块名称:

sbt:root> show mathsweb/webappPrepare
...
[info] * (/home/james/code/multi-module-single-webapp/mathsweb/target/webapp,)
...