springspring-bootvaadinvaadin8

Spring Boot 2.5 .war packaging with Vaadin static resources


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.


Solution

  • 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)
    }