Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT - Refreshing changes with 'Development Mode' with Maven

If I use GWT's Development Mode with Eclipse, changes that I make in the IDE are immediately reflected in my browser upon refresh. However, I can't seem to get the same result when using the maven plugin to build. Is this possible?

Here's what I've tried:

  1. Running gwt:run, making a change and saving it in Eclipse, refreshing the browser.
  2. Same as above but clicked the 'restart server' button on the GWT Development Mode console.
  3. Telling Eclipse that my project is a GWT project and configuring a Web Application, but it fails to list any Entry Point Modules for me to choose from.
  4. 'webAppCreator -templates maven com.xx.WebApp' - creates just a pom, no project (?).

The only option seems to be: stop the console, gwt:compile, gwt:run. This cycle takes minutes each time..

Any ideas on how to achieve this, or if it's even possible? Not being able to do this is really a show stopper for us adopting GWT, since we can't scrap maven.

TIA, Roy

like image 695
Roy Truelove Avatar asked Aug 18 '11 22:08

Roy Truelove


1 Answers

The real answer to this question came from Thomas Broyer's comment, but I wanted to spell out all of the steps that I took for future reference:

With Maven:

  • Create the project using the gwt maven plugin archetype.
  • Move the xxx.gwt.xml file from the 'resources' tree to the 'java' tree, as recommended by Thomas.
  • Run 'mvn clean install' to ensure that all's well, and to generate the async classes.
  • To get around this issue, add this to your pom. When you change your maven dependencies you'll need to run a maven compile to get them to take in Eclipse.

With Eclipse:

  • Import the project into Eclipse using 'Import Existing Maven Project'
  • Right-click on target -> generated-sources -> gwt, and select Build Path -> Add to Build Path.
  • In project properties -> Google -> Web Toolkit, 'Use Google Web Toolkit' is checked.
  • On the same page, add your entry point modules.
  • In project properties -> Google -> Web Application, ensure that 'This project has a WAR directory' is checked, and the dir points to 'src/main/webapp'
  • Right-click on the project, select Run As -> Web Application

Ready to go!

like image 162
Roy Truelove Avatar answered Sep 21 '22 08:09

Roy Truelove