I've finally managed to launch development mode using OSGi, GWT and optionally eclipse. The solution was on the -noserver
flag of the GWT dev mode, it's not aware of the changes in code while the application is running, but it can be used for debugging the compiled code and to receive the exception traces.
I also managed to run the development shell without eclipse, but if you are not interested on this solution you can directly jump to the eclipse integration section.
Without Eclipse (only exceptions, no debug)
You need to know the following information:
- Where do you have your source (
$SRC
)
- Where do you have your GWT libraries (
$GWT_PATH
), specially gwt-user.jar
and gwt-dev.jar
.
- (Optionally) the port from wich your HTTP OSGi server serves the application (
$PORT
).
- The startUp url of your application (
$URL
)
- The package containing the .gwt.xml file for your application (
$PACKAGE
).
Then you need to run:
java -cp $SRC:$GWT_PATH/gwt-user.jar:$GWT_PATH/gwt-dev.jar \
com.google.gwt.dev.DevMode -noserver -port $PORT \
-startupUrl $URL $PACKAGE
E.g.:
java -cp src/:lib/gwt-2.0.3/gwt-user.jar:lib/gwt-2.0.3/gwt-dev.jar \
com.google.gwt.dev.DevMode -noserver -port 8080 \
-startupUrl httplocalgui.html es.warp.samples.httplocalgui
And finally you only need to deploy your application as usual, in my example I do it with pax-runner and pax-web, using the default port 8080.
With Eclipse
- Open the debug configuration for your project
- Go to Server tab and uncheck "Run built-in server"
- Go to Attributes tab and add "
-port 8080
" (if 8080 is the port used by your web container). I think that this argument without the built-in server is only used to create the url that the development mode generates to invoke the browser (or that elipse uses to generate an url you can copy and paste in your browser's address bar).
- Deploy your application.
- Access it from a browser with the GWT extension installed (and don't forget to add
?gwt.codesvr=127.0.0.1:9997
)