Any thoughts on why when releasing a new Vaadin / Spring-Boot app in production, Vaadin will not render the custom css in frontend directory although it does in debug mode?
The app is built for production as follows:
mvn install -Pproduction
and then ran the resultant app as follows:
java --enable-preview -jar target\app-1.0-SNAPSHOT.jar
When running via JAR file method, the css is not applied correctly in the browser. Everything else works fine.
When the app is run as follows:
mvn spring-boot:run
All pages are rendered correctly. The css is loaded correctly.
In the LoginView class, the CSS is imported as follows:
@CssImport(value = "./views/login/login-view.css", themeFor = "vaadin-login-overlay-wrapper")
The login-view.css file is located in [project dir]\frontend\views\login-view.css
When running mvn spring-boot:run, the CSS file is picked up correctly, however, when running using the JAR method, it is not. I'm not sure if this is by design or not but I dont see the css files stored anywhere in the resultant JAR file.
To mitigate this, I tried putting the frontend files, inside [project dir]\src\main\resources\META-INF\frontend instead of the default location [project dir]\frontend because I read somewhere that CssImport looks inside the resources\META-INF\frontend folder when running via a JAR. When I put the files in this location, the CSS files are incorporated in the JAR and accessible from http://localhost:8080/frontend/views/login/login-view.css, but alas the LoginView page still doesn't seem to render the CSS.
The app was originally built using the Vaadin app builder. The pom.xml is largely the same as the default one. I'm running Vaadin 19.0.7. Thanks in advance