开发者

Speeding up code changes in Eclipse Web Browser?

I'm developing an application using the Vaadin framework in Eclipse. I'm 开发者_开发技巧using the Tomcat v6.0 servlet and run the application in the Eclipse Web Browser. A problem I've been having though is to have recent changes show in the browser when I test the application.

No matter how many times I restart Tomcat, clean all published resources and restart the Eclipse Web Browser the changes still won't take effect. The changes seem to take effect randomly where time is the biggest factor, which is of great frustration when developing...

So my question is if anyone else has noticed this problem and have any ideas of how to solve it, if there is a configuration I can do or if I'm missing a step in the restart which blocks the changes from taking effect..?

Any help would be greatly appreciated!


In Vaadin most of the code runs in the server and is contained in normal Java files. There are three levels of resource/class changes:

  1. The runtime "hot code replacement". If running Tomcat in debug mode some Java class changes can be published without redeploying the web application. However, if the Tomcat is configured to "auto publish" (check your server settings in Eclipse), the redeployment is automatically done whenever classes change and this causes full context reload and sessions serialization (see #2) . Hot code replacement can be enhanced using tools like JRebel.

  2. Web application deployment. This is essentially deploying a new war file to the server. Causes the previous version to be undeployed and deploys the new version of all classes and resources. Sometimes there are some resources left in the servers work directory or classes are not reloaded, in which case the server restart (#3) is needed.

  3. Server restart. This makes the whole JVM to reload and all the classes and web applications are also reloaded. Still cleaning the work directory separately is needed to make sure everything is reloaded.

In addition to this there is the client-side part of Vaadin (essentially a JavaScript compiled with GWT), which is treated as a static resource by Tomcat. If you modify the client-side Java code the GWT is used to recompile the JavaScript. Deployment should be simply file copying. The browsers cache the generated HTML/JS files, but GWT includes mechanism to avoid this.

You should first try to change the server settings for automatic publishing and see if that helps. Also, I've noticed that different Tomcat version behave differently. This is unfortunate, but the only thing you can do is to try to find the versions/set-up that works for you.


Just to make sure: you have been adding ?restartApplication in the URL to force application to restart on page reload, haven't you?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜