In order to use gwt-maven-plugin, you will need to configure it using the plugin configuration in your POM, and you will need to decide how you want to handle GWT being present (automatic or manual mode - more below).
Regardless of which "mode" you use, automatic, or manual, you also need to configure gwt-maven-plugin itself, of course.
Also, as a convenience it helps to define a property for the GWT version (so you can change it in one place later to upgrade).
For example:
<properties>
<gwt.version>1.6.4</gwt.version>
</properties>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<goals>
<!-- gwt:* goals to be executed during build -->
</goals>
</execution>
</executions>
</plugin>
Getting the plugin is simple. It is deployed in maven default repository "central", so you don't have to do anything !
The plugin needs to know where to find GWT (jars and native libraries). There are two ways you can do this.
If you are going to do automatic setup, you need to include the GWT dependencies in your POM. The plugin will detect this version and use it internally.
For example:
<!-- GWT dependencies (from maven "central" repo) -->
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
Note : Don't define gwt-dev as project dependency : this JAR has many common libraries packaged that may conflict with the ones defined for your project, resulting in uncomprehensible NoSuchMethodErrors. The gwt-maven-plugin will automagically resolve the required dependency based on your declared gwt-user dependency.
If you are going to setup GWT manually, for example if you want to test latest build or a patched one, you will need to first unpackage it (http://code.google.com/webtoolkit/download.html). Then, you will need to tell gwt-maven-plugin where GWT is. This can be done with the gwtHome plugin configuration parameter or the google.webtoolkit.home property (this property is unset for automatic mode, but required for manual mode).
<property>
<google.webtoolkit.home>C:/MyCustomGWT</google.webtoolkit.home>
</property>
You can also use the $env.GWT_HOME syntax to refer to an OS environment variable.
For manual mode, you also need the GWT dependencies defined (these are required because plugins and goals other than gwt-maven-plugin need them, like the standard compiler).
Note that with manual mode, even though the dependencies are still needed, the difference is that the source of the dependencies can be your locally installed GWT location (GWT_HOME), rather than a Maven repository, and there is no separate step to unpack the native libraries (they are already in gwtHome).
For example:
<property>
<google.webtoolkit.home>${env.GWT_HOME}</google.webtoolkit.home>
</property>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>custom</version>
<scope>system</scope>
<systemPath>${env.GWT_HOME}/gwt-servlet.jar</systemPath>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>custom</version>
<scope>system</scope>
<systemPath>${env.GWT_HOME}/gwt-user.jar</systemPath>
</dependency>
. . . .
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>generateAsync</goal>
</goals>
</execution>
</executions>
</plugin>
Google Eclipse Plugin requires your web application to be created as an exploded WAR in /war (hard coded path). To match this requirement, you have two options :
The gwt-maven-plugin has a boolean inplace parameter to configure the option you choose. The inplace mode is interesting if you use JSPs as no build/packaging/deployment is required to see changes made in the JSP file. Same applies to static files like CSS.