GWT Gradle plugin

Gradle plugin to support GWT related tasks.

Web application

Using gwt-gradle-plugin to configure a web application project is the most common use-case. Quickstart shows how to configure GWT based web application projects.

Library project

If you create your own GWT library (e.g. widget library) you will only need some of the funtionality provided by the plugin. What you need for this kind of project are basically the GWT dependencies. As such a project does not provide an entry point, there's nothing to compile or run.

To configure a library project, simply use the "gwt-base" plugin instead of applying "gwt" and "war" plugins. Additionally, you do not have to specify any GWT module.

1
2
3
4
5
6
7
8
9
buildscript {
    [...]
}

apply plugin: 'gwt-base'

gwt {
    gwtVersion='2.6.0'
}

Compile only

This is the kind of project if you use GWT without deploying your application as a *.war file. In this case you typically don't use the "war" plugin but running the GWT compiler is needed. To configure this kind of project, you can use the "gwt-compiler" plugin:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
buildscript {
    [...]
}

apply plugin: 'war'
apply plugin: 'gwt'

gwt {
    gwtVersion='2.6.0'
    modules '<YOUR-GWT-MODULE>'
}

As nobody but you knows what you want to do with the GWT compiler output, the plugin does nothing else than configuring the task "compileGwt". You are responsible the this task is called by setting appropriate task dependencies.

Typical use-cases for this are: * Uploading the GWT compiler output to a maven repository to be consumed by other projects. * Consuming the GWT compiler output an another project of a multi-module build

The first use-case can be configured the following way:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
buildscript {
    [...]
}

apply plugin: 'gwt-compiler'
apply plugin: 'maven-publish'

gwt {
    gwtVersion='2.6.0'
    modules '<YOUR-GWT-MODULE>'
}

task gwtZip(type: Zip) {
    from tasks.compileGwt.outputs
}

group='<YOUR-GROUP-ID>'
version='<YOUR-VERSION>'
publishing {
    publications {
        mavenJava(MavenPublication) {
            artifact gwtZip {
                extension = 'zip'
                classifier = 'gwt'
            }
        }
    }
    repositories {
        maven {
            url project.file('repo').toURI()
        }
    }
}

The second use-case can be set up in the following way if the consuming project is a web project:

1
2
3
4
5
apply plugin: 'war'

war {
    from project(':compile-only').tasks.compileGwt.outputs
}