Vaadin on Grails 3.x

[see my update for Vaadin 8 at the bottom!]

Over the last ten years I’ve been doing quite a lot of work with Grails and ZK plugged-in  and got great results – and I got quite used to using a component based UI toolkit in Grails. Unfortunately the ZK plugin for Grails only supports the Grails 2.x branch (with it’s latest update in Sept 2014) so that ceased to be an option for new projects.

Vaadin on the other hand also is a vibrant and powerful component toolkit for Java, so I’d fancy it as a replacement… but  so far, Ondrej Kvasnovsky’s Vaadin-Plugin was also only available for the Grails 2.x branch which is at the time being (April 2017) over 2 years  behind… so unfortunately, Vaadin wasn’t really an option for a component based UI toolkit in Grails either lately – quite a dire situation for a Grails addict.

But now Ondrej has finally finished his version of the Vaadin-Plugin for the current Grails 3.x branch. It plugs Vaadin 7.7.8 into Grails 3.2.8 (or later) – while Vaadin 8 is already supported by a later version of the same plugin right now (see note at the bottom).

The Vaadin-Website has a great Getting-Started Tutorial at which walks you step by step through the creation of a customer list and form and even comes with a set of videos – and which I recommend as a good first introduction to Vaadin with Java. I’ve created a Groovy-vied version of this tutorial using Gorm against H2-DB  in order to test the old version of the Vaadin plugin against Grails 2.x and documented the result in this blog post.

For the new Grails3- Vaadin-Plugin I’ve adapted this tutorial project – and the plugin seems to work just well – YEAH! Here is how to put this togehter:

As of now, the new plugin’s documentation / tutorial is only on the plugins issues-pages on github – you’ll need to follow the steps therein, but note:

  • you might install Grails 3.2.8 using sdkman
  • my demo project uses the package and name of ‚demo.grails3vaadin‘,
    so instaed of ‚grails create-app sample-project‘,
    you ‚grails create-app demo.grails3vaadin‘
  • you don’t need Spring, so seed your project
    using ‚gradle vaadin-quickstart‘
  • then you drop in the files of my demo-project
  • notice that in VaadinConfig.groovy I’ve changed
    the openSessionInViewFilter to use hibernate5

That should do the job!
All the best & cheers, weHe

Update:  since version 2 the plugin uses Vaadin 8
(as opposed to 7.7.8 in the earlier version used here):