/ Vaadin Framework


A Vaadin plugin for Gradle

I have now been using Gradle with Vaadin for a while and even though the experience using gradle out-of-the box is pretty good, there are some things that still could be improved upon when using Vaadin. So I came up with the idea of creating a Vaadin plugin which would handle most of the tedious things you normally do with Vaadin and relieve you of copy&pasting the same build scripts over and over again.

The plugin should be really easy to use, the only thing you will need to include in your projects build.gradle configuration file is the following line and you will have all tools available to build Vaadin 7 applications:

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

By including that line the most recent version of the plugin will always be downloaded and in use. By default the project will be using the latest Vaadin 7 release.

To see what tasks the plugin provides you can run gradle tasks and you will see that the following tasks are provided by the plugin:

createVaadinComponent - Creates a new Vaadin Component.
createVaadinProject - Creates a new Vaadin Project.
createVaadinTheme - Creates a new Vaadin Theme
devmode - Run Development Mode for easier debugging and development of client widgets.
superdevmode - Run Super Development Mode for easier client widget development.
themes - Compiles a Vaadin SASS theme into CSS
vaadinRun - Runs the Vaadin application on an embedded Jetty Server
widgetset - Compiles Vaadin Addons and components into Javascript.

As you can see it provides the most of the functionality you use when developing Vaadin applications. I won't go through all the tasks here but usually you will start with creating a new project with the createVaadinProject task and then you can run it with the vaadinRun task.

Of course you are not limited to any specific version of vaadin when using the plugin. The plugin supports both vaadin 6.x as well as Vaadin 7. The way you can configure this as well as other properties for the plugin is by adding a vaadin configuration to the build.gradle configuration. The following properties are currently supported by the plugin:

vaadin.version - Vaadin version (Vaadin 6 and 7 supported). Defaults to latest Vaadin 7
vaadin.widgetset - The fully qualified name of the widgetset (eg. com.example.helloworld.MyWidgetset)
vaadin.servletVersion - What server version is your application using. Default is 2.5
vaadin.debugPort - On what port should the debugger listen. Default is 8000
vaadin.gwt.style - Compilation style of the GWT compiler. Default is OBF.
vaadin.gwt.optimize - Optimization level of the GWT compiler. Default is 0.
vaadin.gwt.logLevel - The log level of the GWT compiler. Default is INFO.
vaadin.gwt.userAgent - The browsers you want to support. All browser are supported by default.
vaadin.devmode.noserver - Do not run the embedded Jetty server when running devmode. Default is false.
vaadin.devmode.superDevMode - Add support for super devmode

The most important ones which you most likely always want to configure are the version and widgetset properties.

Naturally this as all my projects are open source and freely available to use. The project source code is hosted at github https://github.com/johndevs/gradle-vaadin-plugin where you will always find the latest information about the plugin.

Finally, I leave you with two youtube videos where I am creating Vaadin applications in just minutes using the gradle plugin. Enjoy ;)