views:

331

answers:

2

I know that the job would be simpler if I use Google Plugin for Eclipse.

However, in my situation, I heavily adapted Maven and thus, the plugin cannot suit me. (In fact, it gave me the whole week of headache).

Rather, I relied on a ant script that I learned from http://code.google.com/webtoolkit/doc/latest/tutorial/appengine.html

The document was very clear; I follow the article and successfully invoked DevMode using ant devmode. However, the document didn't tell me about debugging GWT (like Google Plugin for Eclipse can do).

Basically, I want to add some parameter to an ant task that expose a debug port (something like (com.google.gwt.dev.DevMode at localhost:58807)) so that I can connect my eclipse to.

How can I do that?

A: 

I have successfully done this with the following ant task (the build.xml file sits in the root of the GWT project):

<target name="devmode" description="Run development mode">
    <java failonerror="true" fork="true" classname="com.google.gwt.dev.DevMode">
        <classpath>
            <pathelement path="${project.class.path}" />
            <pathelement path="${project.src.path}" />
        </classpath>
        <jvmarg value="-Xmx512M" />
        <jvmarg value="-Xdebug" />
        <jvmarg value="-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000" />
        <arg value="-startupUrl" />
        <arg value="http://localhost/whatever" />
        <arg value="-noserver" />
        <!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
        <arg value="-war" />
        <arg value="." />
        <arg value="-logLevel" />
        <arg value="DEBUG" />
        <arg value="com.example.Application" />
    </java>
</target>

Then I created a "Remote Java Application" launcher that connects to that debug session with "Connection Type" set to "Standard", "Host" set to the hostname of the machine and "Port" set to 8000.

Haven't tested it in a while though but it did work before :)

Arthur
To the best of my memory, as I have commented right below my question, you need to put each of the arguments (`-Xdebug`, `-Xnoagent`, `-Djava.compiler=NONE`, `-Xrunjdwp`) on separated jvmArg tag in order for the debug to work.
Phương Nguyễn