Gradle plugin to support GWT related tasks.
This chapter will guide you through the first steps to configure gwt-gradle-plugin for your web application project.
As it is not a core Gradle plugin, you have to ensure, that Gradle knows how to get the plugin. To do this, add the following lines to your build.gradle:
| buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'de.richsource.gradle.plugins:gwt-gradle-plugin:0.6'
}
}
|
If you do not want to use Bintray's JCenter repository, you can also use the following repository that only contains the plugin itself:
| buildscript {
repositories {
maven {
url 'http://dl.bintray.com/steffenschaefer/maven'
}
}
}
|
Supposed you already applied the gradle "war" plugin to your project, you have to also apply the "gwt" plugin:
| apply plugin: 'war'
apply plugin: 'gwt'
|
Now you have to configure the GWT modules to compile into your web application:
| gwt {
modules '<YOUR-GWT-MODULE>'
}
|
If you want to use automatically configured GWT dependencies (gwt-dev, gwt-user, ...) you have to extend the configuration to set the desired GWT version:
| gwt {
gwtVersion='2.6.0'
modules '<YOUR-GWT-MODULE>'
}
|
The plugin applies the default optimization settings but that can be adjusted. The following example shows how to adjust some of the flags (please refer to the official documentation on what these flags do):
| gwt {
compiler {
enableClosureCompiler = true; // activates -XenableClosureCompiler
disableClassMetadata = true; // activates -XdisableClassMetadata
disableCastChecking = true; // activates -XdisableCastChecking
}
}
|
To build the *.war file including your compiled GWT modules, simply call "gradle build". If you want to start the GWT development mode simply call "gradle gwtDev".
When running the task “gwtDev” you can specify a system property “-DgwtDev.debug=true” to enable debugging. This causes the build to stop when starting development mode and waiting for a debuger to attach to port 5005. Now you can configure your IDE to connect to that debug port.