Update: v2.6 looks like it will have a better example launcher for superdevmode (see under superdevmode at http://www.gwtproject.org/release-notes.html#Release_Notes_2_6_0_RC1 ) 2.6 will be released any day now. I am using RC3 and it seems fine. More here:
While I appreciate the detail on how SuperDevMode works in Thomas' article, what is really needed is a step-by-step guide with some trouble shooting.
Here is a step-by-step. There are so many places to go wrong and the SuperDev mode page is not very specific. Hopefully this makes it clear:
- Configure your module .gwt.xml file with the additional lines (you should place this at the bottom of you module definition, ie just before
</module>
):
<add-linker name="xsiframe"/>
<set-configuration-property name="devModeRedirectEnabled" value="true"/>
<!-- enable source maps -->
<set-property name="compiler.useSourceMaps" value="true" />
Run the standard GWT compile process - in Eclipse this is "GWT Compile Project..." - this is what you typically do when you are deploying GWT code. No doubt you have a maven or ant command that does this as well.
Start a regular webserver that you'd normally use when developing your GWT code. For example, the one you used normal DevMode with. I'll call this one localhost:8888 - I'm going to presume the page you'd normally launch is index.html, so http://localhost:8888/index.html
shows your GWT app. (you probably have ?gwt.codesvr=127.0.0.1:9997
in that URL normally)
Start the SuperDevMode server (see the bottom of this answer for two methods). You now have two webservers running - on different ports. So, lets say SuperDevMode is running on localhost:1234
. At the bottom of this answer I posted some ways to start SuperDevMode.
Point your browser to the SuperDevMode server, so http://localhost:1234
. Follow the instructions to and copy the two shortcuts to your addressbar
Now, point your browser to the regular webserver, http://localhost:8888/index.html
- do not add ?gwt.codesvr=127.0.0.1:9997
to the URL - that is only for NotSuper DevMode. (ie regular DevMode)
Click on the shortcut link "DevMode On" that you copied in Step 5. It should ask you to choose a module to compile, click the Compile button.
If you want sourcemaps (see your java source code in the Chrome script browser) you must turn it on in Chrome. In my version of Chrome (Ubuntu) there is a little gear on the bottom right of the Chrome console (Inspect Element, then look on the bottom right of the browser window). Click that and find "Enable Source Maps". Reload the page and it should now show you the Source codes.
Two ways to launch super dev mode:
From the command line
java -classpath $GWT_HOME/gwt-codeserver.jar:$GWT_HOME/gwt-dev.jar:$GWT_HOME/gwt-user.jar:app:./lib/* com.google.gwt.dev.codeserver.CodeServer \
-bindAddress 0.0.0.0 -port 1234 -src src -workDir work com.foo.MyModule
From an Eclipse Laucher
In Eclipse, create a new Java Application Launcher (not a Web Application launcher!) with the following configuration:
Main Class:
com.google.gwt.dev.codeserver.CodeServer
Program Arguments:
-src src -workDir ${workspace_loc:MyProject}/codeserver -port 1234 com.foo.MyModule
-workDir
is optional
VM arguments ( These may be needed depending on the size of your project. If the superdevmode "Compile" button (in the browser) disappears immediately after you click and nothing seems to happen, it may be crashing because of insufficient memory)
-Xmx1024m -Xms512m
Classpath: add gwt-codeserver.jar, gwt-dev.jar and gwt-user.jar to the launch classpath (these jars are found in the GWT SDK installation directory).