Build and debug GWT applications on a remote system using SSH port forwarding

Originally posted on 2020-11-06

Sometimes my local machine is just too slow to build and iterate on some code. When this happens I like to fire up a cloud instance with beefy specs and do my builds there.

With GWT and SSH port forwarding I can build my code on a fast machine and even access super dev mode. I set up a shell script that syncs my code with rsync to the instance so I use IntelliJ locally, sync my code, refresh my browser and see the changes very quickly.

To set up SSH port forwarding for GWT I use this command:

ssh -L 8080: -L 9876: user@ip

This forwards Jetty (port 8080) and the GWT code server (port 9876) back to your system on localhost. Then I open up my localhost debug URL as normal (e.g. http://localhost:8080/appname) and everything just works.

One caveat is that on the remote machine I usually need to do a full build first to make sure the initial HTML and JavaScript files are in place for Jetty. Otherwise I may get a blank screen and an error from my GWT bookmarklets that says no modules are on the page.

What does my syncing script look like? Check out my