views:

904

answers:

2

I'm trying to move our Google Web Toolkit (GWT) development from Eclipse to IntelliJ 9 Community edition. So far I've been able to run and debug client/server code successfully via the GWT Maven plugin and its embedded Jetty container.

However, I'm having trouble debugging client code when it is already running on a remote machine (and hence there's no need for the embedded Jetty container).

Has anyone been successful at achieving this? Any help would be appreciated!

UPDATE: I was finally able to accomplish this. Please see my own answer below...

+1  A: 

When running a GWT app deployed on a remote server, the client part of your app will have been translated into javascript so I do not think you will be able to debug this from IntelliJ. The server side part of your app will still be Java code. You should be able to start up this remote server with java debugging parameters (things like a transporttype and a port to listen to). From IntelliJ, you should be able to start up a remote debugging session using the same transporttype and port. If you look into remote debugging, you should be able to find how to do this.

dafmetal
+3  A: 

I was finally able to accomplish this by using GWT's DevMode class, as described in the documentation.

In short -

  • Add your project to IntelliJ 9 Community edition
  • Add an Application run/debug configuration
  • Use com.google.gwt.dev.DevMode as your main class (make sure to include gwt-user and gwt-dev jars to the project classpath. See here)
  • Add the following program parameters:

    -noserver -war "[full path to your exploded war]" -gen "[full path to generated files]" -logLevel INFO -port [remote server port] -startupUrl "[URL of the remote page]" [com.company.YourEntryPoint]

This way, the DevMode runner will not instantiate the built in container and will allow your remote server's JavaScript to be debugged in its original Java form.

Note that for builds that don't require debugging remote client code you may use Maven or Ant integration, which is much simpler. I don't have any experience with the webAppCreator generated build.xml, but with Maven you could simply run the gwt:run or gwt:debug goals with this parameter: -DrunTarget=

Hope it helps!

Nadav