Friday, May 11, 2012

GWT + Maven + Eclipse = Pain

GWT was definitely not designed with Maven in mind, and getting it all to work within Eclipse is a nightmare. I have managed to get this mostly working, here is what I have so far.

Please install Eclipse with the m2eclipse and GWT plugins.

Start by using the GWT archetype, sadly, this will not produce a project that works, but at least gets you pointed in the right direction.

mvn archetype:generate \
 -DarchetypeRepository=repo1.maven.org \
 -DarchetypeGroupId=org.codehaus.mojo \
 -DarchetypeArtifactId=gwt-maven-plugin \
 -DarchetypeVersion=2.4.0

This will request some details, including a module name. Go ahead and enter in all the fields, but the first thing you will need to do is a search on the entire project in eclipse for literally ${module} and replace that with the actual name of your new module. You should at least find this problem in the org.eclipse.wst.common.component xml file.

You will also notice that the pom.xml file has some compilation issues. I have not figured out how to resolve other than commenting out the offending lines. This doesn't seem to hurt anything, but you will need to manually generate the Async interfaces.

Next up, you will need to create a Run Configuration, most easily done by right clicking your project -> run as -> (G) Web Application. This will throw some error about needing to include the module name in the arguments. So go find the Run Configuration that it created and tack on the end the full path to your endpoint (eg. com.myapp.MyEndPoint)

Now you should be able to get the server standing by following the run as step above again.

You will notice that there are still some funky warnings being spat out, which I have not totally figured out yet, but hopefully this will help someone out.

No comments:

Post a Comment