New theme in a maven and jetty embedded application

In my Vaadin application I am using maven and an embedded jetty server, so my tree structure doesn’t follow the standard. Basically, under my web module I have a src folder with all the sources. Everything is working fine, the Vaadin repositories are imported by maven and I’m using Valo theme.
My problem is that I want to create my own theme now but I don’t know where to place it so Vaadin can find it.
The error I get:

Requested resource [/VAADIN/themes/mytheme/styles.css] not found from filesystem or through class loader. Add widgetset and/or theme JAR to your classpath or add files to WebContent/VAADIN folder. This is the configuration of the server:

WebAppContext appContext = new WebAppContext(); appContext.setContextPath("/"); appContext.setResourceBase("."); jetty.setHandler(appContext); ServletContextHandler servletHandler = new ServletContextHandler(jetty, "/dev", true, false); servletHandler.addServlet(servletHolder, "/Test/*"); servletHandler.addServlet(servletHolder, "/VAADIN/*"); I’ve tried to create a structure like this: VAADIN/themes/mytheme in the root of the module and many other options but I couldn’t get the new theme to work, because I don’t know where VAADIN is looking for the personalised themes. Or am I missing any configuration?

Thanks for the help

When using Maven, Vaadin usually looks for the theme in src/main/webapp/VAADIN/themes/

yep thanks, I have tried that location too with no luck

Do you think I should make maven pack the theme in the jar explicitly?

Yes, make sure it is available on the classpath as resource “/VAADIN/themes/mytheme/styles.css”.


Hi, I’ve been able to include my theme as a resource. Now I have a problem with the compilation of scss. This is the error I get:

jul 15, 2015 11:19:55 AM com.vaadin.server.VaadinServlet serveOnTheFlyCompiledScss
WARNING: Could not read persisted scss cache
at Source)
at com.vaadin.server.VaadinServlet.loadPersistedScssCache(
at com.vaadin.server.VaadinServlet.serveOnTheFlyCompiledScss(
at com.vaadin.server.VaadinServlet.serveStaticResourcesInVAADIN(
at com.vaadin.server.VaadinServlet.serveStaticResources(
at com.vaadin.server.VaadinServlet.service(
at javax.servlet.http.HttpServlet.service(
at org.eclipse.jetty.servlet.ServletHolder.handle(
at org.eclipse.jetty.servlet.ServletHandler.doHandle(
at org.eclipse.jetty.server.session.SessionHandler.doHandle(
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(
at org.eclipse.jetty.servlet.ServletHandler.doScope(
at org.eclipse.jetty.server.session.SessionHandler.doScope(
at org.eclipse.jetty.server.handler.ContextHandler.doScope(
at org.eclipse.jetty.server.handler.ScopedHandler.handle(
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(
at org.eclipse.jetty.server.Server.handle(
at org.eclipse.jetty.server.HttpChannel.handle(
at org.eclipse.jetty.server.HttpConnection.onFillable(
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(
at org.eclipse.jetty.util.thread.QueuedThreadPool$
at Source)

jul 15, 2015 11:19:56 AM com.vaadin.server.VaadinServlet persistCacheEntry
WARNING: Could not persist scss cache because no real file was found for the compiled scss file. This might happen e.g. if serving the scss file directly from a .war file.

How can I make the scss compiler compile on the fly? What am I missing?


The real solution is that you should do the theme compilation in compilation phase. I hate to say it, but providing this on the fly sass compilation is a architectural flaw in Vaadin, just causing problems and performance issue. I’m never using it. If I have a custom theme in my application, I’m compiling the theme by IDE tooling - during the development.

Add this to your vaadin-maven-plugin configuration:

<goal>compile-theme</goal> Then the actual css file is generated during the build. After that you can also finetune the build by exluding obsolete dependencies like vaadin-sass-compiler and also the .scss files from your jar/war file.


That worked, thank you very much!

That worked for me also. Thanks a lot!

Hi Enkara,

You said, “I’ve been able to include my theme as a resource.” If you don’t mind, kindly show me how you did that.

Thank you.


Hi Enkara,

No need. I think I’ve got it. Thanks anyway.


Hi Dan,

It might help somebody else if you’d share the solution. My guess is that you first didn’t pre-compile the theme into your theme jar file?


Hi Matti,

Following Mattis advice I added:


to my Maven plugin configuration and following Éric’s advice which I found here:

I put my theme here:



yep thanks, I have tried that location too with no luck