Vaadin maven repository load css file (Vaadin 24.4.8)

Hello could I ask about correct create maven dependency and correct select of possibilities add css file for class?
so I used @CssImport()

and I use Spring boot and when I run application without vaadin:prepare-frontend than I get error:
Servlet.service() for servlet [dispatcherServlet] in context with path [/saveyourtime] threw exception [com.vaadin.flow.server.ServiceException: java.lang.IllegalStateException: com.vaadin.flow.server.ExecutionFailedException: Discovered @Theme annotation with theme name ‘saveyourtime’, but could not find the theme directory in the project or available as a jar dependency. Check if you forgot to create the folder under ‘xyz\themes’ or have mistyped the theme or folder name for ‘saveyourtime’.] with root cause

is other way how create maven dependency or use other annotation? Css file in dependency will by use only in classes of dependency , no for whole project where dependency will added

CssImport is the correct annotation to add a CSS file in a jar dependency.

1 Like

Take a look as inspiration how it’s correctly done within an add-on Code search results · GitHub

1 Like

Thank you, I worked according to your instructions, but the result was the same. The program can only be run after vaadin:prepare-frontend, otherwise it still throws an exception.

Sounds like a problem with the dev bundle