Vaadin 7, Gradle, Jetty, Eclipse

Hi all.

For my first Vaadin project, I try to get the following setup working:

  1. I want to use Vaadin 7. (Why to use Vaadin 6, if new version is due very shortly?)
  2. I want to package my project as an “executable” war. That means a war file, with embedded Jetty.
  3. I want to develop from Eclipse and to have edit-compile-see cycle without packaging a war file and restarting Jetty.
  4. And I want to use Gradle as my build system.

I have understood from googling “Vaadin Jetty”, that Jetty is, in fact, a container of choice for many of Vaadin team. But there is no any hints or how-tos on Vaadin site about using embedded Jetty in Vaadin applications. Or can anybody point me to one?

My second problem is that if I use Vaadin Eclipse plug-in and create a Vaadin project, then I get Jetty 6 from Vaadin’s ivy.xml . I would prefer to use Jetty 7/8 from Eclipse.

And I have no idea how to get “hot-redeploy” functionality without using JRebel. (We are startup, and JRebel is not on the top of our budget :slight_smile: )

Can anybody share some useful hints with me?

Thank you in advance
Nikem from Plumbr :slight_smile:

Vaadin is just a set of libraries that you deploy in a WAR. So if you want to use Jetty as your container, you just need to configure Jetty as you normally would and then deploy your WAR into it. You have two options: start Jetty as a standalone container and deploy into it or embed Jetty and have it load your application at startup. I prefer the latter and you can find instructions
here
. The general process is completely independent of Vaadin and will simply load your WAR which has your Vaadin based application in it.

As for the Eclipse plugin, I haven’t used it much. There might be an updated/beta version for Vaadin 7. I usually just use the quickstart Maven archetype and then add the Vaadin dependencies to my POM and write/copy an existing web.xml. It isn’t all that hard to do yourself if you need to. Checkout the Book of Vaadin or the Vaadin 7 tutorial wiki for info on setting up the Vaadin servlet in your web.xml.

I don’t have complete hot-deploy working as I don’t have JRebel either but I use the Maven/Jetty plugin which will do context reloading when it detects changes or you can have it wait until you trigger it (by pressing enter). You can find more information about it
here
.

I believe you can use Maven plugins via Gradle but there is also a Gradle/Jetty plugin that might be a little more integrated.

-mike

I was unable to find a way to call Maven plugins from Gradle. And Gradle native plugin for jetty seems to lack reloading capabilities.

I have tried to copy Maven plugin functionality, and got my context reloading. But for some reason java classes remain the same, so no luck with hot-redeploy so far :frowning:

You’ll probably want to ask this question on a Gradle or Jetty mailing list. Vaadin is just a framework in a WAR so how you create the package and deploy it is outside the scope of Vaadin itself.

Gradle is pretty flexible and you can execute any Groovy code you want. Maybe someone has an example of starting Jetty directly from the command line using Process. You could also hack your way through it by writing a pom.xml and simply calling “mvn jetty:run” from your Gradle script.

-mike

I have written a tutorial on how to develop Vaadin applilcations with hot-deployment using Maven and Eclipse. This doesn’t answer your Gradle related questions, but the article might give you other valuable insights that help you with your task. You find the tutorial
here
.

Hope that helps.