Fork me on GitHub

Migrating from Mojo’s Maven Plugin for GWT

The Maven Plugin for GWT is very different from Mojo’s Maven Plugin for GWT.

To begin with, Mojo’s plugin is tightly linked to a specific version of GWT, whereas the Maven Plugin for GWT is independent of the GWT version. This means that when migrating, you have to add dependencies to gwt-dev to your project.

The module is managed in src/main/module.gwt.xml by default. When migrating your project, you have to either move your module file to src/main/module.gwt.xml or disable the gwt:generate-module goal by setting the skipModule configuration property to true.

Next, most goals of Mojo’s plugin have no equivalent in the Maven Plugin for GWT. Only Mojo’s plugin’s gwt:compile and gwt:run-codeserver (and to some extent gwt:run) have equivalent goals, namely gwt:compile and gwt:codeserver (and gwt:devmode) respectively. The gwt:codeserver and gwt:devmode goals are quite different from Mojo’s gwt:run-codeserver and gwt:run though: the Maven Plugin for GWT has been designed from the beginning with multi-module projects in mind, if only because The Maven Way™ dictates to separate your client- and server-side code into separate modules (for many reasons). I strongly believe this makes it much better, but that means it works quite differently.

Finally, the way you configure the plugin is much different: the Maven Plugin for GWT has few properties, and arguments are passed to GWT explicitly through list properties (<compilerArgs> et al.) This allows the plugin to be usable with many versions of GWT, and allows you to control the arguments’ order (that one being important for GWT in some cases). The downside is that it makes it harder to change the configuration on-the-fly through properties you could set on the command-line (for example); an alternative is then to prepare some presets in profiles, and enable the appropriate ones as needed. Don’t forget to take advantage of the combine.children="append" attribute, particularly when defining such profiles.