/ Vaadin Framework

What is new with Gradle Vaadin Plugin 0.9

It took all summer but finally it is ready, the next minor release of the Gradle Vaadin Plugin. And what a release it turned out to be.

Lets take a look at what the new release brings.

Say hello to Groovy support

Some have asked why the plugin only works with Java projects and not Groovy projects, after all, Gradle is using Groovy behind the scenes. The major reason is that Vaadin has for long time not been very focused on other JVM languages and mostly only catered to the pure Java folks. However, times are changing and more and more people are writing Vaadin applications in other languages like Groovy and Scala and to cater those, tooling around those languages are starting to emerge.

Following that trend I am pleased to announce the major feature of 0.9, introducing a whole new plugin for Groovy development.

The plugin fully utilized the power of the already existing Java plugin and using the plugin is as easy as using the Java one, to get started just create a build.gradle file and apply the plugin. Like so:

apply from: 'http://plugins.jasoft.fi/vaadin-groovy.plugin'

After that the plugin will configure your project to be fully groovy friendly.

All the tasks available in the Java plugin will exist in the Groovy plugin but will instead of generating Java classes directly generate Groovy example classes.

To create a new Groovy project you can start by running the vaadinCreateProject task. It will create the project folder structure and generate some template groovy classes for you to start with. Once the project has been created you will have a nice UI class which looks like this:

class MyApplicationUI extends UI{

        def void init(VaadinRequest request){

                content = ['Hello vaadin'] as Label


Looks a bit different from Java, eh? :)

vaadinRun task gets a face lift

One of the major concerns from our Windows users have been that for some the vaadinRun task has not at all worked, for other it has worked but the logging and termination of the task has been problematic. I'm happy to say the the logging has been fully re-written and should now work on all platforms better. You can still choose if you want the logs of the various tasks to go to a file or directly to the console with the logToConsole option. Also the logging is now much smarter, passing log messages from different processes directly to Gradle's own loggers with the correct log levels.

The terminateOnEnter configuration option has been removed as, quite frankly, it has never worked as intended. In the future you will always have to kill the task with Ctrl+C/Cmd+c/or whatever the IDE provides.

But since I now took away that option, let me provide you with another new feature so nobody gets sad. The vaadinRun task will now monitor the class files for changes while it is running and reload the Jetty server if a class file is changed. That means that if you are working in an IDE and the IDE recompiles the class file the vaadinRun task will notice it and restart the server so you only have to refresh the browser and the changes are immediately visible. Of course, if you rather want to attach a Java debugger to the process or use JRebel to update your class files, you can. In that case you probably want to use the new configuration option vaadin.plugin.jettyAutoRefresh and set it to false.

Jetty gets an update

The plugin has long been using Jetty 8 as an embedded server for running the project with the vaadinRun task. The new minor version will upgrade the embedded jetty version to Jetty 9.2 (9.2.2 to be exact) bringing better support for Java 8 projects among other things.

Plugin moves over to Gradle 2

Gradle 2 brings major improvements in building speed and IDE integration and to be able allow the plugin users to use all of those features the plugin needs to take the big leap and move over to Gradle 2. The downside is that many API's have changed and it is not possible to build a plugin that would support both simultaneously. This sadly means that the plugin is no longer backward compatible with Gradle 1.x projects. If you cannot upgrade to Gradle 2 yet you can always stay on the latest 0.8.2 version on the plugin by appending the version parameter to the plugin URL. (e.g. apply from: 'http://plugins.jasoft.fi/vaadin.plugin?version=0.8.2).

Plugin gets a new home

The plugin has previously been hosting directly from jasoft.fi which is my own server but since Bintray entered the scene it is a much better place to host the upcoming releases. The project releases will from now on all be found here https://bintray.com/johndevs/maven/gradle-vaadin-plugin.

Why is this better you may ask. Well, besides it taking off some bandwidth from my personal server, moving to Bintray also will provide the plugin community with new features.

Another great thing is that every plugin release will now also be available from JCenter. This means that if you don't want for some reason use the jasoft.fi plugin URL you can download the plugin directly from JCenter by adding the JCenter repository to your gradle build file.

Also what is cool about Bintray is that provides nice community features. You can rate the plugins, view download statistics, get notified of new versions and what is best, get your voice heard by writing a review of the plugin!

Finally, I have heard rumors about even better Bintray support in Gradle itself, which would make including the plugin even easier in the future, more about it here ;)

Snapshot builds

Ever wanted to try out a new feature before release? Just got that one pull request through in Github and want to share it with our friends? I have several times been in this exact situation and now I want to fix that by providing the community with snapshot builds of the plugin so you can get a glimpse of what is to come.

The easiest way to use a snapshot build is to just append a snapshot version to the plugin URL. Here is an example of getting the latest snapshot of 0.9 version:

apply from: 'http://plugins.jasoft.fi/vaadin.plugin?version=0.9-SNAPSHOT'

Currently snapshot builds are not built on any schedule, I will trigger a new snapshot build once a while to test a feature or if you request an update. Later, if there is a need, I might schedule them to build at some interval.

The rest and looking forward

While developing the new minor release there has been plenty of bug fixes fixed, mostly for better IDE integration and Windows platform support. Also the internals of the plugin has been revamped and simplified leveraging more and more Groovy only features.

Currently also the plugin does not take advantage of all what Gradle 2 provides but now that the plugin is on Gradle 2 we can soon start using the new features (community plugin support, incremental java compilation, task cancellation support etc.) See latest release notes for Gradle at http://www.gradle.org/docs/current/release-notes for further information about what to come.

If you want to join the development of the plugin the source code and documentation can be found on https://github.com/johndevs/gradle-vaadin-plugin. If you want to contribute a new feature, fix a bug you found or just discuss idea's you can add them all as pull requests or issues to the Github repository. The more, the merrier, I'd say :)

And that is all folks, hope you find the plugin useful and keep contributing with your ideas, bug reports and patches.

Keep up the good work!