Scaladin and SBT configuration

I thought maybe someone should start a thread for those who are using SBT to build Vaadin projects. There’s a few gotchas and places to get tripped up in an SBT Scaladin / Vaadin project. I’ll start off by giving my experience in adding DontPush OzoneLayer to an SBT project. Here’s what I wrote to the SBT mailing list, and I’m putting it here for future Vaadin users.

DontPush OzoneLayer) can be added to the sbt dependencies like so:

libraryDependencies ++= Seq(etc, “org.vaadin” % “dontpush-addon-ozonelayer” % “0.4.6”, etc.)

The problem is that for some reason Jetty gives the following exceptions:
org.eclipse.jetty.servlet.ServletHolder$1: java.lang.reflect.InvocationTargetException
… and so on, until:
Caused by: java.lang.UnsupportedOperationException: Please remove the atmosphere-compat-jetty from your classpath

Okay, so I add:
“org.vaadin” % “dontpush-addon-ozonelayer” % “0.4.6” exclude(“org.atmosphere”, “atmosphere-compat-jetty”)

But, that doesn’t exclude the atmosphere-compat-jetty from the lib_managed folder (I’ve set retrieveManaged := true) or the build (I still get the same error). Just to check to see if it was this dependency that was transitively bringing in the atmosphere-compat-jetty jar, I set:

“org.vaadin” % “dontpush-addon-ozonelayer” % “0.4.6” intransitive()

And that excluded it. And all the other jars it needs as well, of course. So, how to solve it? According to the old googlecode sbt pages I found a way to manually use the ivy xml to set the exclusion:

ivyXML :=

And that works. So, I guess the exclude() function isn’t working correctly? Or am I using it wrong? Although the sbt wiki is getting better, I wish it had a simple search box and more examples.

For future Vaadin / atmosphere users, you then have to add a second dependency after excluding that module:

“org.eclipse.jetty” % “jetty-websocket” % “8.0.1.v20110908”

After that it all works fine. Hope this helps folks in the future.

As a quick tip for anyone wanting to try out Scaladin with SBT there is a
template for Scala + Vaadin projects. You can find it
. Just as an example, here are the required steps to get an SBT project running:

g8 ripla/vaadin-scala
<answer questions, enter for defaults>
cd <project dir>

Suggestions, bugfixes and comments are welcome. I’m also planning to do vaadin-scala-on-steroids kind of template to show some other frameworks alongside Scaladin e.g. Subcut, Scalatest…

Thanks Risto, the more information gathered into one thread the better.

Although, for me, I needed to compile a new GWT widgetset before container:start would work. Run the gwt-compile command from sbt to do this. You might also want to put

gwtVersion := "2.4.0"

after your seq(gwtSettings: _*) in the build.sbt file.

I just tested and it seemed to work fine for me.

Somehow I managed to miss the web.xml reference to the widgetset, thanks! It’s fixed now.

Thanks for the tip, I’ll look into that.

Would you mind posting the body of your build.sbt file? I was able to get DontPushOzone working with SBT on my machine recently, but only after a significant amount of hassle that involved many failed SBT configurations. Unfortunately the result doesn’t seem to work for the other contributors on my project.

Thanks and great job,

Steve Thompson

Hello Steve,

Sorry for the late reply – I have to remind myself to check for replies. Here is the build.sbt file you can use as a good start. Let me know if you need any other information!


here’s the code just case that gist goes away:

import net.thunderklaus.GwtPlugin._

name := "Scala Experiment Server"

scalaVersion := "2.9.1"

seq(gwtSettings: _*)

gwtVersion := "2.4.0"

seq(webSettings: _*)

// JRebel settings
seq(jrebelSettings: _*)

jrebel.webLinks <++= webappResources in Compile

//not sure which of these is necessary:
scanDirectories := Nil

scanDirectories in Compile := Nil

// uncomment this if we don't want to generate rebel.xml 
// jrebel.enabled := false

retrieveManaged := true

retrievePattern := "[type]

resolvers += "Vaadin add-ons repository" at ""

ivyXML :=
  <dependency org="org.vaadin" name="dontpush-addon-ozonelayer" rev="0.4.6">
      <exclude org="org.atmosphere" module="atmosphere-compat-jetty"/>

// basic dependencies
libraryDependencies ++= Seq(
  "com.vaadin" % "vaadin" % "6.7.6",
  "org.vaadin" % "dontpush-addon-ozonelayer" % "0.4.6",
  "org.vaadin.addons" % "scaladin" % "1.0.0",
  "org.eclipse.jetty" % "jetty-webapp" % "8.0.1.v20110908" % "container",
  "org.eclipse.jetty" % "jetty-websocket" % "8.0.1.v20110908"

// hack: sbt-gwt-plugin assumes that sources are in src/main/java
javaSource in Compile <<= (scalaSource in Compile)

gwtModules := List("org.cpoile.ExperimentServerWidgetset")

// more correct place would be to compile widgetset under the target dir and configure jetty to find it from there 
gwtTemporaryPath := file(".") / "src" / "main" / "webapp" / "VAADIN" / "widgetsets"

And the plugins.sbt file:


// xsbt-web-plugin
resolvers += "Web plugin repo" at ""  

resolvers += " M2 releases" at ""

libraryDependencies <+= sbtVersion(v => "com.github.siasia" %% "xsbt-web-plugin" % (v+"-0.2.11"))

// sbt idea
resolvers += "sbt-idea-repo" at ""

addSbtPlugin("com.github.mpeltonen" % "sbt-idea" % "1.0.0")

resolvers += " M2 releases" at ""

addSbtPlugin("fi.jawsy.sbtplugins" %% "sbt-jrebel-plugin" % "0.9.0")

// GWT compiler
resolvers += "GWT plugin repo" at ""

addSbtPlugin("net.thunderklaus" % "sbt-gwt-plugin" % "1.1-SNAPSHOT")

Also forgot to add, you have to put ?restartApplication at the end of your url is order to see changes made to a running application.



I’m new to Vaadin, but I feel adventurous and would like to try out the latest version, and with Scala. So I try to get a simple Vaadin “Hello World” to run with
Scala 2.10.1
Vaadin 7.0.3
Scaladin 3.0.0 (build from github sources)
sbt 0.12.2

I get some example code to compile, but when I run


all I see is

javax.servlet.UnavailableException: Servlet Not Initialized

and a stack trace.

Does someone by any chance have a working build.sbt for Scaladin 3 / Vaadin 7 ? Or maybe someone can point me to an example / hello world application for this combination somewhere?


Here’s a simple sbt setup that works:

├── build.sbt
├── lib
│   └── scaladin_2.10-3.0.0-SNAPSHOT.jar
├── project
│   ├── plugins.sbt
└── src
    └── main
        ├── scala
        │   └── com
        │       └── example
        │           └── MyScaladinUI.scala
        └── webapp
            └── WEB-INF
                └── web.xml


name := "myproject"

scalaVersion := "2.10.1"

libraryDependencies ++= Seq(
  "com.vaadin" % "vaadin-server" % "7.0.3",
  "com.vaadin" % "vaadin-client-compiled" % "7.0.3",
  "com.vaadin" % "vaadin-themes" % "7.0.3",
  "javax.servlet" % "servlet-api" % "2.4",
  "org.eclipse.jetty" % "jetty-webapp" % "8.1.10.v20130312" % "container"

seq(webSettings :_*)


libraryDependencies += "com.github.siasia" %% "xsbt-web-plugin" % "0.12.0-"


<?xml version="1.0" encoding="UTF-8"?>
<web-app id="VaadinScala" version="2.4" xmlns="" xmlns:xsi="" xsi:schemaLocation="">
        <display-name>Scaladin Application</display-name>
                Vaadin production mode</description>
                <servlet-name>Scaladin Application</servlet-name>
                <servlet-name>Scaladin Application</servlet-name>


package com.example

import vaadin.scala._

class MyScaladinUI extends UI {
  content = Button("Click me!","Hello World!"))

Hi Henri,

sweet, thanks!

My web.xml was wrong, I tried to use the one generated by “g8 ripla/vaadin-scala” , but apparently servlet class and init parameter name have changed. But following your example it works fine.



Yes, that template is for Vaadin 6 and Scaladin 2.x.


hello henri,

I tried to copy the example you gave, but I have an error while entering “sbt” :
scala.reflect.internal.FatalError: object Predef does not have a member $qmark$qmark$qmark
I add that I used this plugins.sbt:

libraryDependencies += “com.github.siasia” % “xsbt-web-plugin_2.9.2” % “0.12.0-”

because sbt was unable to find the former file.
Do you know what’s wrong?

xsbt plugin was moved to, so you should add in plugin.sbt:

addSbtPlugin(“com.earldouglas” % “xsbt-web-plugin” % “0.7.0”)

Take a look into Henri’s example projects
, and visit plugin

By the way, it will be great achievement if you sort out plugins documentation in vaadin. Currently, for a significant amount of plugins they are located outside Vaadin site. Spring is an excellent example how documention should be presented.