Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
532 views
in Technique[技术] by (71.8m points)

java - Is it possible to debug GWT client code on a REMOTE server using IntelliJ 9 Community Edition?

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...

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...