Google GWT: Editing Server Side GWT Code with Partial Recompilation

This article is meant to teach developers how to edit GWT server side code with partial recompilation. That is to say, to teach developers how to avoid having to completely restart the GWT app. I’ve decided to author this article because I’ve recently worked with a team that did not know this ability existed or rather, could not find a way to setup partial recompilation.

Use Case: Reduce GWT application compile time and increase developer productivity.

Prerequisites: The gwt-maven-plugin org.codehaus.mojo is placed in your pom.xml.

  1. Run project with mvn gwt:debug in the command line. Wait until “[INFO] Listening for transport dt_socket at address: 8000”
  2. Listen on port 8000 with your preferred IDE utilzing a remote configuration. If this is confusing, you can follow the debugging tutorial located at Google GWT: Debugging Server Side GWT Code.
  3. Edit any code in the server package.
  4. Reload the changes in the IDE (Control + Shift + F9 in Intelilj).
  5. Optional: Navigate to “GWT Development Mode” window -> click “Jetty” tab -> click “Restart Server”. I’ve noticed that with larger code changes this is required but not for small code changes. The disadvantage is that it takes time to restart the server. If possible, try to avoid this.
  6. Set breakpoints to verifying that the code that you changed actually updated.

That’s it! You can partially recompile GWT apps!

Leave a Reply

Your email address will not be published.