Spring Boot 2.5 .war 与 Vaadin 静态资源打包

发布于 2025-01-13 21:42:34 字数 695 浏览 6 评论 0原文

我有一个 Vaadin 8 应用程序(在可预见的将来无法升级 Vaadin),它正在从 Spring Boot 1.5.x 升级到 Spring Boot 2.5.x。我正在使用可自动执行的 .war 打包。

问题是生成的 .war 文件不包含已编译的主题 .css 文件 (styles.css),因此应用程序无法正确呈现。 在 .war 内部,/VAADIN/themes/[themename] 文件夹仅包含以下文件:

在此处输入图像描述

Spring Boot 1.5.x 版本的同一文件夹包含以下内容:

,对于 Spring Boot 2.5.x,在构建过程中生成的带有 -plain.war 后缀(不包含依赖项)的 .war 文件,确实有 .css.css.gz 文件。因此,似乎是在 Spring Boot 重新打包期间,这些文件从最终的 .war 中删除了。

I have a Vaadin 8 application (can't upgrade Vaadin for the foreseeable future) that is being upgraded from Spring Boot 1.5.x to Spring Boot 2.5.x. I'm using self-executable .war packaging.

The problem is that the resulting .war file does not contain the compiled theme .css files (styles.css) so the app doesn't render properly.
Inside the .war, the /VAADIN/themes/[themename] folder only contains these files:

enter image description here

While the same folder for the Spring Boot 1.5.x version contains these:

enter image description here

Interestengly, for Spring Boot 2.5.x, the .war file that is generated with the -plain.war suffix (not containing the dependencies) during the build process, does have the .css and .css.gz files. So it seems to be during Spring Boot's repackaging that the files are removed from the final .war.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

讽刺将军 2025-01-20 21:42:34

升级到 Spring Boot 2.5.x 后,任务显然没有按正确的顺序执行。
我通过在 gradle 构建脚本的 bootWar { } 块中使用 dependsOn 修复了这个问题:

bootWar {
    launchScript()

    ...

    dependsOn(vaadinCompile, vaadinThemeCompile)
}

After the upgrade to Spring Boot 2.5.x, tasks were apparently not executed in the correct order.
I've fixed it by using dependsOn in the bootWar { } block of the gradle build script:

bootWar {
    launchScript()

    ...

    dependsOn(vaadinCompile, vaadinThemeCompile)
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文