开发者

How to debug GWT using Ant

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 o开发者_如何学Cf 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?


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 :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜