Over the past few days I have been trying to create/run a project in Eclipse using the gwt-maven-plugin and keep running into roadblocks (see some of my previous questions). I like to use Maven to do my builds, but I’m at the point where I’m thinking of going the Ant build route because of the complications of using Maven.
Does anyone out there have it configured/working well? Is it just me or is this harder than it should be?
After much frustration trying to get things to play nicely together, this is the setup I have that “works” for me. “Works” meaning that I can create, run and debug a GWT project with tweaks, but it isn’t the most elegant solution.
Much of the steps are the same as Pascal’s answer in this post: Maven GWT 2.0 and Eclipse. I’ll list mine out to be clear.
In Eclipse (Helios) with m2eclipse and GWT Eclipse plugins installed:
Create a new Maven project using the gwt-maven-plugin archetype
Modify the pom.xml:
<gwt.version property>to 2.0.4 (needs to be same as GWT Eclipse Plugin version)
<maven.compiler.target>properties to 1.6
- add maven-war-plugin to pom.xml
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.0.2</version> <configuration> <warSourceDirectory>war</warSourceDirectory> <webXml>src/main/webapp/WEB-INF/web.xml</webXml> </configuration> </plugin>
Update project Properties:
- Google -> Web Toolkit, check the “Use Google Web Toolkit” box, and ensure “Use default SDK (GWT-2.0.4) is selected.
Run Maven “gwt:eclipse” goal on project (sets up environment and launch config)
Copy *.launch file to workspace.metadata.pluginsorg.eclipse.debug.core.launches
I created a Run Configuration that does
mvn clean compile gwt:run. The gwt:run is necessary to copy the resources and lib jars into the war directory. However, it does not copy the web.xml from src/main/webapp/WEB-INF into war/WEB-INF/. So, I have to manually copy that file.
If I want to run my application, the above step is sufficient. However, if I want to debug the application, I launch it by choosing the Google “Web Application” configuration from Debug Configurations that was created when the .launch file was copied previously. This configuration allows for debugging (breakpoints etc.) without any other config or need for remote debugging.