GWT Gradle plugin

Gradle plugin to support GWT related tasks.

Plugin configuration

The plugin registers an extension named "gwt" of type GwtPluginExtension with the Gradle model. This extension defines the conventions/defaults for all GWT related tasks. If you use the extension to do the configuration, the plugin ensures that the configuration properties are consistently set as default values to all related tasks. All properties that are common to multiple/all GWT related tasks are defined in the extension itself (e.g. used GWT modules). Properties that a re specific to one kind of task are defined in specific sub-objects.

An example of both kinds of properties looks this way:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
gwt {
    gwtVersion='2.6.0'

    modules 'de.richsource.gradle.plugins.gwt.example.Example'
    
    compiler {
        strict = true;
        enableClosureCompiler = true;
        disableClassMetadata = true;
        disableCastChecking = true;
    }
    
    dev {
        noserver = true
        port = 1337
    }
}

In addition to specifying properties in the plugin extension, it's also possible to overwrite the defaults for specific tasks.

An example of configuring the "compileGwt" task to use different GWT modules looks like this:

1
2
3
compileGwt {
    modules = ['de.richsource.different.module']
}

Available configuration parameters

In the following list you can find the interfaces/classes that define specific tasks as well as their associated configuration object in the plugin extension:

Test configuration

The plugin's support of testing is not based on a custom task but instead extends the existing Test task of Gradle.

To do this, every instance of Gradle's Test task is dynamically extended to have a prperty "gwt" of type GwtTestExtension. In addition, an instance of GwtTestOptions is added as property "test" to the plugin's extension object. Using this, you can again specify defaults for all instances of the Test task.

To activate the manipulation of Test tasks to support GWT tests, you have to add the foollowing to your build.gradle:

1
2
3
4
5
gwt {
    test {
        hasGwtTests = true
    }
}

Common cases

Memory settings

You can change the memory settings for all GWT related tasks (compileGwt, gwtDev, ...) with these properties:

1
2
3
4
gwt {
    minHeapSize = "512M";
    maxHeapSize = "1024M";
}

To change those settings for only one specific task you can also set these settings for this task only:

1
2
3
4
compileGwt {
    minHeapSize = "512M";
    maxHeapSize = "1024M";
}

The default value for both, minHeapSize and maxHeapSize is "256M".

Log level

The log level of GWT tasks is automatically configured depending on Gradle's log level. So by default this is "ERROR".

If you change Gradle's log level (e.g. by adding "--info" or "--debug" on the command line), this also affects the log level of GWT related tasks.

To change the log level independent of Gradle's log level, you can do this:

1
2
3
gwt {
    logLevel = 'INFO'
}

The availeble log levels are defined in the enum LogLevel.