1
votes

Is there a standard easy way to launch Jetty from eclipse for the production mode?

I followed the instructions at http://code.google.com/webtoolkit/usingeclipse.html to setup a new project using gwt and eclipse.

The hosted (debug) mode seems to be already configured to work properly and involves one click in eclipse using "Debug as".

I would like to configure "Run as" to run the production mode in jetty. Is there a good tutorial on the standard way to set this up?

2
Did you encounter any problem? Because just run 'hosted mode', with compiled sources and access the page with the url without the ?gwt.codesvr= parameter. - Hilbrand Bouwkamp
Oh didn't know you could do that. That worked. - user782220
@HilbrandBouwkamp Hmm when I try that it always says "GWT module '..' may need to be (re)compiled" - letmaik

2 Answers

0
votes

You have to compile your GWT-project before you can "Run As". It's the button with a red box and "G" on it.

0
votes

Since GWT compiles to java script you don't need jetty if you don't have server-side logic... anyway, in a normal scenario you'll have some server interaction, BUT you're not sticked to jetty; tomcat or other server side technology could be used.

You can deploy the compiled JS to a web server and the server side logic to tomcat, jboss, jetty... even you could interact with php at the server. Deployment to Google AppEngine is another option, a natural option if you use the eclipse plugin since it's tightly integrated with it.

In eclipse, Jetty is no more than a java process started like any normal java main. Go to [Run]->[Run Configurations]->[Web Application]->[Your GWT Project] and you'll see a normal java main exec config.

Look at the [Main Class] option -> this is the embeded jetty ..or at the [VM arguments] for the JVM

The ?gwt.codesvr= param in the URL only instruct the browser plugin to interact with the eclipse plugin embeded jetty in a way that only the modified code is re-compiled to JS and sent to the browser. If you do not use the ?gwt.codesvr= probabilly you'll have to recompile all the project every time you change a single line of code.

I recommend you to clearly separate the compiled-to-js code and the server side code in different eclipse projects. I also run the embeded jetty only for the client-side code; the server side code is run in tomcat.

That way I have a clear separation of layers at the time I can debug client-side GWT code and server-side java code.