The Google Plugin for Eclipse is a nice integration of GWT inside Eclipse to make development easier. It can be used to launch the DevMode with a simple right click and provides several wizards and tools, and optionally the GWT Designer.
Your maven project will end something like this. Please note the Module.gwt.xml module descriptor located in src/main/java directory :
pom.xml |_src |_main |_java | |_ com/mycompany/gwt/Module.gwt.xml | |_ com/mycompany/gwt/client | | |_ ModuleEntryPoint.java |_resources |_webapp | index.html |_WEB-INF |_web.wml
Your Maven configuration will be something like this :
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.mycompany</groupId> <artifactId>webapp</artifactId> <packaging>war</packaging> <version>1.0-SNAPSHOT</version> <dependencies> <dependency> <groupId>com.google.gwt</groupId> <artifactId>gwt-user</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>com.google.gwt</groupId> <artifactId>gwt-servlet</artifactId> <scope>runtime</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>gwt-maven-plugin</artifactId> <version>2.7.0</version> <executions> <execution> <goals> <goal>compile</goal> </goals> </execution> </executions> <configuration> <runTarget>index.html</runTarget> </configuration> </plugin> </plugins> </build> </project>
With this setup, you can start your GWT module with a single right-click in your Eclispe IDE with Run as : Web application.
You can the edit your java code and just hit refresh to see changes applied in the browser.
Import your maven project into eclipse using m2eclipse import wizard (or your prefered tooling). The Google Plugin for Eclipse should automatically enable the GWT nature on the project. If not, manually enable it from project preferences by setting the Use Google Web Toolkit checkbox (the GWT SDK should be picked from your POM).
Big projects may want to split the client-side application in modules, typically using Maven support for multiprojects. The project layout will the become something like this (maybe with some more classes) :
pom.xml // reactor project |_domain // shared with other (GWT or Java) projects | |_src | |_main | |_java | | |_ com/mycompany/domain | | | |_ User.java | |_resources | | |_ com/mycompany/Domain.gwt.xml |_webapp |_src | |_main | |_java | | |_ com/mycompany/gwt/Module.gwt.xml // inherits Domain.gwt.xml | | |_ com/mycompany/gwt/client | | | |_ ModuleEntryPoint.java ...
When using Eclipse-Maven integration like the m2eclipse plugin, other maven projects open in the workspace will be automagically resolved as projects (instead of JARs). When the referenced project is well configured (*) as a GWT module project, changes to java sources will be available in DevMode with a simple refresh with no requirement to repackage the modules.
(*) A "well configured GWT module project" is expected to have Java sources copied as resources in the project build outputDirectory (using gwt:resource goal) and a dedicated gwt.xml module file to define the required inherits.
The gwt-maven-plugin src/it/reactor project can be reviewed as a demonstrating sample of this setup.