开发者

Gwt and eclipse with jetty for production mode

开发者 https://www.devze.com 2023-03-22 21:44 出处:网络
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

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 开发者_如何学JAVAseems 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?


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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号