You can use the following configuration in your pom.xml to run the GWT compiler when the project is built. By default, the compile goal is configured to be executed during the ''compile'' phase.
<project>
[...]
<build>
<plugins>
[...]
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<module>com.mycompany.gwt.Module</module>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
[...]
</plugins>
</build>
[...]
</project>
You can also configure compilation for multiple modules by nesting them inside a ''modules'' element. If none is set, the plugin will scan project source and resources directories for ''.gwt.xml'' module files.
See user guide for more details.
The generateAsync goal will create a generate-sources folder and Async interface for all RemoteInterface found in the project. To avoid a full scan, only Java source files that matches a pattern (defaults to ''**/*Service.java'') are checked.
See user guide for more details.
<project>
[...]
<build>
<plugins>
[...]
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<servicePattern>**/gwt/**/*Service.java</servicePattern>
</configuration>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>generateAsync</goal>
</goals>
</execution>
</executions>
</plugin>
[...]
</plugins>
</build>
[...]
</project>
The i18n goal will create a generate-sources folder and Message (or Constants) interface for the ResourceBundles specified in configuration. You can specify the "constantsWithLookup" or "message" parameters to choose the interface hierarchy (Message or Constants) to use, "Message" beeing used by default.
See user guide for more details.
<project>
[...]
<build>
<plugins>
[...]
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<i18nMessagesBundle>com.mycompany.MyApp</i18nMessagesBundle>
</configuration>
<executions>
<execution>
<goals>
<goal>i18n</goal>
</goals>
</execution>
</executions>
</plugin>
[...]
</plugins>
</build>
[...]
</project>
The eclipse goal can be used to create an Eclipse launch configuration for executing the GWT module in hosted browser mode. The required native libraries are also downloaded and installed in the user local repository. This goal is not intended to be part of a build phase, but to be executed from command line mvn gwt:eclipse.
See user guide for more details.
The eclipseTest goal can be used to create an Eclipse launch configuration for executing the GWTTestCase-based unit tests. The required native libraries are also downloaded and installed in the user local repository. Simply run mvn gwt:eclipseTest.
To avoid conflicts with unit tests, we recommend to follow the naming convention to prefix your GWT tests with ''GwtTest''
GWTTestCase requires some complex setup that makes it difficult to run in Maven with the Surefire plugin. Such tests also are long and start the whole GWT module, so they are not ''unit'' but ''integration'' tests.
The test goal can be used to run GWTTestCase during the integration-test phase. It will fork a process with the required arguments to run the test, and will report on the console the result. It will also create the standard Surefire reports to be used by project site reporting.
<project>
[...]
<build>
<plugins>
[...]
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>1.1</version>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
[...]
</plugins>
</build>
[...]
</project>
This plugin declaration could be part of a profile, so that it gets only enabled on continuous integration server, as such test execution is long and will penalize the developper.
See user guide for a detailled description of testing with GWT and Maven, and suggestion about using GwtTestSuite.