问题
I'm new to gwt. I don't know how to start up Super Dev mode. I need the detailed explanation step by step.
I have tried editing gwt.xml file by adding
<add-linker name="xsiframe"/>
<set-configuration-property name="devModeRedirectEnabled" value="true"/>
<set-property name="compiler.useSourceMaps" value="true" />
but i cant get the idea about this.
回答1:
Follow these steps, you 'll definitely find the solution.
Download the GWT 2.5 RC2, and put it somewhere...I put it in my eclipse/plugins directory. link
In Eclipse, add GWT 2.5 to the
Project -> Properties -> Google -> Web Toolkit -> Configure SDKs
screen, and select the 2.5 version that you have added to the directory in the step above.Right click on the project in Eclipse, go to its Run Configurations window, and create a new "Java Application", name it something like "GWT Super Dev Mode".
While in the Run Configurations window, do the following:
Set the project based on your project name, and type in the main class as com.google.gwt.dev.codeserver.CodeServer
On the
Classpath tab
, clickuser Entries
, then clickAdd External JARs
, navigate to the GWT 2.5 directory, and find the gwt-codeserver.jar, and click "Open" (and other external libraries).In the Arguments tab, add
-src src/ *SOURCE PATH OF YOUR PROJECT*
to Program arguments, and add optional-Xmx1024m
to VM arguments.Click Apply, then go ahead and Run the project.
After this you will get a URL like, localhost:9876/
Goto that URL, and bookmark,
Dev Mode ON
andDev MOde Off
then run your code, remove the suffix gwt.codesvr=127.00.1:9997 in the URL. Now clickDev Mode ON
...
Hope you get the solution...
回答2:
UPDATE: starting with GWT 2.7, DevMode will actually use Super Dev Mode automatically by default, so you just have to launch DevMode like you did previously, and the app will be (re)compiled automatically on page (re)load.
One difference is that a special .nocache.js
is generated so you must ensure this specific file is loaded by the browser; to debug a remote server (like you could do previously with DevMode running with -noserver
), you'll have to use the bookmarklets as described below though.
To run in Super Dev Mode, you must go through 2 preparatory steps:
Super Dev Mode only works with the
xsiframe
linker, so make sure you have the following line in your.gwt.xml
too:<add-linker name="xsiframe" />
That linker is safe for production use (Google uses it everywhere, slightly customized), so feel free to turn it on for all your projects (it combines the best of the
std
linker –the default one– and thexs
linker, without their downsides).Note: that linker will be the default in 2.7
If you use a version of GWT before 2.6.0, you'll also have to enable Super Dev Mode in your
.gwt.xml
:<set-configuration-property name="devModeRedirectEnabled" value="true" />
Otherwise, if you intend to use Super Dev Mode from a URL different from
127.0.0.1
orlocalhost
, then you'll have to whitelist the host. This is done using a regexp, e.g.:<set-configuration-property name="devModeUrlWhitelistRegexp" value="http://(mymachinename|192\.168\.5\.151)(:\d+)?/.*" />
See https://stackoverflow.com/a/21938574/116472
compile and deploy your app to a web server near you (if you used a
.gwt.xml
file specific to Super Dev Mode, make sure you compile that one module: thexsiframe
linker anddevModeRedirectEnabled
property are necessary for that compilation step!)If you use GWT-RPC, set the system property
gwt.codeserver.port
to the port you'll run Super Dev Mode on (defaults to9876
) so your server can download RPC serialization policies right from the Super Dev Mode.
If you run them on different machines, you'll have to overridegetCodeServerPolicyUrl
in all of yourRemoteServiceServlet
s. Consider the security implications though, as noted in the javadoc
Once that's done you can start a Super Dev Mode session:
Launch
com.google.gwt.dev.codeserver.CodeServer
with the same classpath that you'd launch DevMode with (i.e.gwt-user.jar
,gwt-dev.jar
and all your client-side dependencies: e.g. GXT, GIN+Guice, GWTEventBinder, etc.) but addinggwt-codeserver.jar
; and passing the name of your module as argument.It'll start by compiling your module to check that it can actually be compiled; you can skip this step by passing
-noprecompile
as argument.If you never ran Super Dev Mode, go to
http://localhost:9876
and add the Dev Mode On and Dev Mode Off links to your bookmarks (drag/drop them to your bookmarks bar).Note: if you use Maven, you should be able to use
mvn gwt:run-codeserver
(note: there's a bug in the releases of the plugin up to 2.6.0 where you actually have to runmvn process-classes gwt:run-codeserver
; this is fixed in 2.6.1).Open your app in your browser, then hit the Dev Mode On bookmarklet. Click the Compile button in the popup that opens. It should refresh the page and load the JS from the
CodeServer
rather than from your server. Your browser's development tools should also load the SourceMaps so you can see and debug (step by step) your Java code.When you want to test changes you made to your code, hit the Dev Mode On bookmarklet again. Contrary to DevMode, refreshing the page won't make it run the new code; the code has to be recompiled first, and this is done when clicking the Compile button after the Dev Mode On bookmarklet (note: you can also directly bookmark the Compile button to save a click, but note that it's bound to your module, so you'd need multiple bookmarks if you work on several modules).
When you're done, hit Dev Mode Off to make sure you switch back to production mode, then shutdown the
CodeServer
process (CtrlC in the console should work).
Official documentation at http://www.gwtproject.org/articles/superdevmode.html
See also http://blog.ltgt.net/how-does-gwts-super-dev-mode-work/ for more information about how Super Dev Mode actually works.
回答3:
I wrote a simple step by step guideline for hello world project debugging with super-dev-mode Here.
After reading through the step by step guideline with screenshots you cannot miss it.
Also, you can read up on the technology -
GWT SuperDevMode - Ray Cromwell Post and GWT Dev Guide
SourceMaps - GWT and Sourcemaps and HTML5 Sourcemaps
回答4:
Have a look to this video, could help
http://jeff-davis.blogspot.fr/2012/07/setting-up-gwt-25s-superdevmode.html
回答5:
It's super easy now.
Check this
and then add this jar to your classpath
as explained here
来源:https://stackoverflow.com/questions/18330001/super-dev-mode-in-gwt