如何为容器拥有不同的webapp资源:SBT中的启动和打包任务

2024-03-20

我有一个带有纯 JS 前端和 Scala 后端的 Web 应用程序。我想在我的构建管道中使用 Grunt 来处理src/main/web应用程序进入目标分布/网络应用程序我还想保留原始的 JS 和 HTML 文件以使用容器进行本地测试:启动任务,而包任务将使用 Grunt 处理的资源构建我的 WAR 文件。 当我在 SBT 中使用以下设置时:

编译中的 webappResources Seq(bd / "dist" / "webapp") }

然后我实现了第二个目标 - 我的 WAR 是使用 webapp 资源构建的分布/网络应用程序。但是,在本地开发期间使用 container:start 时,我会绑定到同一目录。 有没有办法为不同的目的定义不同的目录?


xsbt-web-plugin 支持 SBT 0.13.1 https://github.com/JamesEarlDouglas/xsbt-web-plugin/blob/master/project/build.properties所以你可以使用更好的语法来定义webappResources in the Compile scope:

webappResources in Compile := Seq(baseDirectory.value / "dist" / "webapp")

我可能错了,但是webappResources独自一人也可以。

webappResources := Seq(baseDirectory.value / "dist" / "webapp")

甚至(除非您想替换原始值而不附加值):

webappResources += baseDirectory.value / "dist" / "webapp"

至于解决方案,我会使用以下(untested) in build.sbt:

webappResources in package := Seq(baseDirectory.value / "dist" / "webapp")

并保留默认值webappResources为当地发展奠定基础。

Read Scopes http://www.scala-sbt.org/release/docs/Getting-Started/Scopes.html了解有关“范围”设置的更多信息,即为不同的设置设置不同的值axes.

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何为容器拥有不同的webapp资源:SBT中的启动和打包任务 的相关文章

随机推荐