Gradle Vaadin Plugin 0.11 beta released
Gradle Vaadin Plugin 0.11 is probably the biggest release since the first version of the plugin came out nearly 4 years ago. Many things under the hood has changed and improved, mostly because of improvements in Gradle itself, but also new features have been added which will help especially those in a more enterprise project.
But lets have a look at the major features this release brings.
Java 8 and Gradle 2.12 required
To be able to make many of the improvements made in 0.11 new features of Gradle needed to be used. That meant that the required version of Gradle had to be bumped. Also, since Java 7 is long now been unsupported by Oracle, the plugin is now solely compiled for Java 8 meaning you will no longer be able to use the plugin with Java 7.
Task configurations
Previously everything was configured inside the vaadin { }
configuration block. While this was convenient for smaller projects, the block became enormous if you utilized many of the options it provided.
Instead, the vaadin { }
configuration now only hosts a few properties related to how the plugin itself behaves, while other configurations have been moved into task specific configurations vaadinCompile { }
, vaadinThemeCompile { }
, vaadinRun { }
and vaadinSuperDevMode { }
. For a closer look into what these configurations contain have a look at the renewed https://github.com/johndevs/gradle-vaadin-plugin page.
The old configuration options inside vaadin { }
are still there and have been marked as Deprecated and will throw a nagging message whenever they are used. This is to allow projects a transition period for moving to the new configurations. I do however encourage you to move as soon as possible, as 0.12 will remove those options and break your build if you still are using them.
Task options
Previously many of the vaadinCreate* tasks did not allow for the user to configure what comes out of those tasks. In 0.11 you can now control some of the aspects of the naming of the files and folders the vaadinCreate* creates with command-line parameters. F.e.x if you want to create a new project with the name MyProject in the package com.my.project you can simply pass the vaadinCreateProject task the parameters vaadinCreateProject --name=MyProject --package=com.my.project
and the right project will be created. Many other options exists for many other of the tasks so for a full look have a look at the renewed https://github.com/johndevs/gradle-vaadin-plugin page.
Automatic widgetset detection
Previously you would always need to define the widgetset using the vaadin.widgetset
configuration so the plugin would be able to recognize the project as a client side project and compile the widgetset. This can still be done using the vaadinCompile.widgetset
option if you manually want to define the widgetset but in most cases it is no longer required and the plugin will find and compile your widgetset automatically if you have addons in your project which require a widgetset or if your project contains the widgetset .gwt.xml
file. You still need to annotate your UI with the @Widgetset
annotation though as the plugin will not touch your source files.
Support for JEE projects
Previously it was nearly impossible to get CDI and EJB projects working with vaadinRun as it was running on a plain Jetty server without support for those JEE features. From 0.11 onward this will no longer be a problem as vaadinRun will now support out-of-the-box these features by changing the server from Jetty to Payara. In fact taking CDI into use in your project is now as simple as adding the Vaadin CDI addon to your dependencies, creating a project with vaadinCreateProject and running it with vaadinRun.
If you however don't need those features and want a slightly faster startup then the jetty server is still available by change vaadinRun.server = 'jetty'
.
Support for Compass SASS
By default all the SASS files in a Vaadin project are compiled with the Vaadin Sass compiler. In 90% of the cases this is most likely very sufficient and I would recommend staying with it if your don't have a special need not to.
However, some designers might be using features of SASS that has not yet been implemented in Vaadin's compiler and so the plugin now also supports switching to Compass SASS easily by only setting vaadinThemeCompile.compiler = 'compass'
.
However, you are paying for these extra features with your build performance as the Compass compiler is significantly slower than the Vaadin compiler. I've written previously more about this is GHOST_URL/gradle-vaadin-plugin-0-11-sneak-peak/ so if you are considering taking Compass into use, please read though the article first.
Better IDE (Eclipse / Intellij) support
The previous plugin relied on injecting dependencies in a way that the IDE's had problems with. Thanks to advancements in Gradle the plugin now uses a separate approach that allows the Gradle integrations in the IDE's to work better with the plugin. Currently the plugin supports out-of-the box both the Gradle BuildShip Eclipse integration as well as Intellij's built-in Gradle support. Just remember to either apply the eclipse-wtp or the idea plugin in addition to the vaadin plugin so the Vaadin plugin knows in what IDE your are working.
Getting your hands on 0.11 beta
The easiest way to take the plugin into use is upgrade your Gradle distribution to 2.12 and add the following to your build.gradle:
apply from: 'http://plugins.jasoft.fi/vaadin.plugin'
// Optional (uncomment):
// apply plugin: 'eclipse-wtp' // For eclipse support
// apply plugin: 'idea' // For Intellij support
If you have any questions or find a bug you will want to get fixed either post as a comment below or open an issue at https://github.com/johndevs/gradle-vaadin-plugin/issues.