Gradle : Multi Module, shared Vaadin Module Setup

Hello All,

Long time, no post. I was going to post this as an “Issue” on John’s Gradle Plugin project - but I think it might need a wider discussion/audience.

Is it possible to setup a multi-module gradle project, like
Maven Overlays for Vaadin Projects
discusses for Maven, whereby all of the Component/Themes are isolated into one (gradle) module?

Reasoning : in one project, we are going to have multiple wars - with the same theme(s) and addons/components; the time taken for widgetset/theme compilation is not inconsiderable, and I’d like ensure that that only occurs only once and and only when necessary - especially when developing.

Has anyone tried this? I started dabbling with this
Gradle WAR Overlay Plugin
, but gave up after a few hours.

All advice and pointers welcomed,




I’ve always considered the Maven overlays a big hack in maven to get project dependencies to work correctly. Unpacking and re-packing WARs are a major performance killer in your build. Instead your build system should be able to solve this in a better way. And Gradle allows you to do so without re-packaging WARs. But, if you insist on that approach you can follow this tutorial to get it done,
. (I discourage this approach, but hey, if it is your thing then who am I to disagree :))

But as I said, you can accomplish this in a much cleaner way.

The thing you want to do is make one module for your widgetset and one module for your theme and have your application modules depend on those.

Include the components that you want to put in the widgetset in the widgetset module and put your theme in the theme module. Ensure that you use the correct folder structure. Then configure Gradle to compile the widgetset and themes in respective modules.

Finally in your application modules you just depend on the widgetset and theme modules. That way the widgetset and theme modules are always only built once which after they never are built by gradle again until you change something in those modules. This should speed up your build quite a bit if you previously have built the widgetset and theme for every application module.

I’ve made an example project of this at

Hope this helps :slight_smile:

Thanks John!