Debug GWT Applications in IntelliJ
This is a short introduction about how to use IntelliJ to debug your GWT application running in SuperDevMode.
- JetBrains IDE Support extension for Crhome: https://chrome.google.com/webstore/detail/jetbrains-ide-support/hmhgeddbohgjknpmjagkdomcpobmllji
- GWT application running in SuperDevMode
- Give it a name and enter the URL of your GWT application (that's the one you get if you press 'Copy to Clipboard' in the 'GWT Development Mode' window)
- Choose Chrome as the browser
- Add mapping(s) between your local files and remote URLs. Therefore choose the local path of your (top level) package in the section named 'Remote URLs of local files (optional):' and map it to the related URL of the code server.
Say you have the local path
src/main/java/org/jboss/hal/clientand your GWT module has the short name
hal. Then the remote URL would be http://127.0.0.1:9876/sourcemaps/hal/org/jboss/hal/client.
- If you have a maven multi module (which is the case for me) you can repeat the last step for each module you want to map. In that case you only need to make sure that you don't map the same URL twice. Use more specific mappings in that case.
- Make sure your GWT application is running in SuperDevMode. I'm using the GWT Maven Plugin from Thomas Broyer (https://tbroyer.github.io/gwt-maven-plugin/plugin-info.html) and execute
mvn gwt:devmodefrom the command line. But actually it's up to you how you start SuperDevMode.
- Choose your Run/Debug Configuration and click 'Debug' or press ⇧F9
- The start page of your GWT application should be loaded in Chrome.
- In the browser you should see a hint saying "JetBrains IDE support is debugging this browser."
- Depending on your application you should see some output in the console view of IntelliJ.
- Add breakpoints in your code. If you setup the mappings correctly, IntelliJ should be activated pausing at your breakpoint. You can now inspect the local variables and walk down the stack.
- Have fun
Let me know if you have problems setting up remote debugging.