cdietze / sbt-gwt-plugin   1.1-105a30073000a6c09d19c1745c49dc58799e68f8

GitHub

Plugin for sbt 0.10 to build GWT projects

Scala versions: 2.10
sbt plugins: 0.13

Looking for maintainer: I am no longer working on this project. If anyone's interested in taking over let me know and we can add a reference to the new project here.

Usage

Add the plugin to your project in project/plugins.sbt:

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

Add the GWT settings to your project in build.sbt:

import net.thunderklaus.GwtPlugin._

seq(gwtSettings :_*)

libraryDependencies += "org.mortbay.jetty" % "jetty" % "6.1.22" % "container"

This adds the GWT compilation task, which can be called directly with gwt-compile. The GWT compilation is automatically triggered when the package-war task is invoked.

Development Mode

Use gwt-devmode to run your module in the GWT development mode shell. By default this runs the first module in the gwtModules list, but one can use the gwt-set-module command to instruct gwt-devmode to use the first module containing the substring passed to gwt-set-module.

Development Mode with Google App Engine

It is possible to run the Google App Engine development server when running the GWT devmode shell. You must simply configure gaeSdkPath:

gaeSdkPath := Some("/path/to/appengine-java-sdk-x.x.x")

If you prefer not to hardcode paths in your SBT build, you can easily extract the path from a shell environment variable like so:

gaeSdkPath := Option(System.getenv("APPENGINE_SDK_HOME"))

Enter the following in the SBT console prior to invoking gwt-devmode to see the exact configuration changes made when running the GWT devmode shell with the Google App Engine dev server:

set logLevel := Level.Debug

Testing with Jetty

You can also test your gwt-compiled app with Jetty, by running jetty-run followed by gwt-compile and then browsing to http://localhost:8080/. Note that to use jetty-run you must add Jetty to your project dependencies like so:

libraryDependencies ++= Seq(
  "org.mortbay.jetty" % "jetty" % "6.1.22" % "jetty"
)

Settings

The default GWT version is 2.3.0 which can be overridden like this:

gwtVersion := "2.2.0"

By default, all GWT modules in the source directory are compiled. You can specify which ones to build like this:

gwtModules := List("net.thunderklaus.hello_gwt_sbt.Hello_gwt_sbt")

Additional arguments can be passed to the JVM used to run GWT devmode and the GWT compiler:

javaOptions in Gwt += "-mx512M"

See also

The GWT settings include the web settings from the project https://github.com/JamesEarlDouglas/xsbt-web-plugin. So, all tasks from that plugin are also available. Have a look at the documentation there.

License

sbt-gwt-plugin is open source software licensed under the Apache 2.0 License. Feel free to use it!