How to debug GWT with Ant

I know that work will be easier if I use the Google Plugin for Eclipse.

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

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

The document was very clear; I follow the article and successfully called DevMode using ant devmode. However, the document did not tell me about debugging GWT (e.g. Google Plugin for Eclipse).

Basically, I want to add some parameter to the ant task, which will output the debug port (something like (com.google.gwt.dev.DevMode on localhost: 58807)) so that I can plug in my eclipse.

How can i do this?

+3
source share
1 answer

I successfully completed this with the following ant task (the build.xml file is in the root directory 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 this debugging session with “Connection Type” set to “Standard”, “Host” set to the host name of the machine, and “Port” set to 8000.

Did not test it after a while, but it worked before :)

+5
source

Source: https://habr.com/ru/post/1738760/


All Articles