How to refresh server code for GWT in IntelliJ (dev mode)? - java

When running a gwt project in dev mode in IntelliJ, if I make any changes to the server-side code, I need to actually stop and run the app again in order for it to be updated.
Is there any other way to refresh the server-side code, so the whole app doesn't have to be restarted?

GWT server code is real Java code, so no, you can't do that by default. However, you could use JRebel (commercial) to achieve what you want.

Related

How to hot deploy code in Tomcat running in debug mode

How to configure Tomcat server in debug mode for Eclipse to support hot deployment? Hot swap or hot code replace without restarting the Server, which can speed up the development.
We can make some changes in tomcat to support hot deploy, there can be different ways to achieve that.
One of the simplest way is making change in tomcat setting in eclipse/STS,
Double click on the Tomcat plugin, refer to publishing tab, make sure "Automatically publish when resources change" is selected.
In the Tomcat Plugin page, click on the Module view, make sure Auto Reload is Disabled. Default is enabled.
**NOTE: **
This is applicable in case of debug mode only
Only method code changes is supported, new added method,class, database script,tomcat is required to be restarted.
Reference:
Click here for mkyong.com link
I'm not sure that it is possible without redeploy and without external tools. For case to update only updated classes/resources I use HotSwapAgent tool
But this tool have some limitations and I wouldn't recommend it for prod.
Hot swap will change the modified class byte code on disk, which will trigger tomcat redeploy. Also hot swap supports only simple changes within method body.
So hot swapping on tomcat is not working out of the box.
There are third party solutions for this, like JRebel.

GWT 2.7.0 Super Dev Mode, don't recompile server side code after change

I am starting to learn GWT.
I've picked up newest version (2.7.0).
I have wrote Entry point class to display start page and to call rpc to server to execute some function.
Every change I made in client side source code in Entry point class, cause auto recompile (hot swap), so I can see immediatly changes, that I've apply.
My problem is that it works only for client side code.
It dosen't work for server side code. To see changes in server side code, I have to stop server and console, and run it again, which is very very annoiyng.
So my question is:
Is it normal behaviour of gwt app server in SuperDevMode in 2.7.0 version? Or am I doing something wrong?
How should I deal with that?
Please give me your thougths about it.
By the way: I use GWT with eclipse and Google plugin.
EDIT
I wonder what about Maven GWT projects? How to deal with them?
What you describe is normal behavior.
There are several ways to reload the server side code when refreshing without restarting your server:
The built in web server does support hot swapping code, but only if you do not modify method or class signatures. If you do change them (or add a class or method), a server restart is required.
You might need to configure your Eclipse to auto re-publish any code changes to your web server.
There are 3rd Party Eclipse plugins which improve the hot code reloading mechanism, for example JRebel, which allows hot code replacement even if you change method or class signatures.
There's a "reload webapp" button in DevMode. It's in the "Jetty" tab when using "bare" DevMode, and a yellow double spinning arrow in the Eclipse view when using the GPE. It'll restart the web app just as if you redeployed it in a standalone server.
I found this solution:
https://github.com/jbarop/gwt-hotdeployment
It seems to do the job for developer.
But it is quite old.

Does GWT 2.6 Super Dev Mode supports hot swap (recompile) and how?

Recently I started to use Super Dev Mode to get look&feel of it. It took me couple of hours to get it up but I didn't find out how and actually can you use SDM for faster development using hot swapping.
Using Dev Mode all I had to do is save my changes in IDE and refresh the browser page. Now my code changes needs to get transferred to the code server to be recompiled? Am I right or am I missing something obvious?
All you have to do is click the DevMode On bookmarklet and Compile button. This is for client-side code only though.
For server-side code, whereas DevMode can serve your webapp and you can reload it with a single click to get your changes in, CodeServer only deals with the client side, so you have to deploy your webapp to a server (that said, you can use DevMode if you want). You then need to re-deploy your webapp when you make changes to your server-side code.
See https://stackoverflow.com/a/18333050/116472 for a detailed step-by-step howto.

Can I set GAE's dev_appserver to automatically reload context when I change .class files?

I'm using Google AppEngine with their built in web server. My development goes about in a simple way: I make changes to my .java sources or .jsp and compile using ant and to see the changes I have to restart the development server.
I'm wondering if there's a way I can avoid this last step of restarting my development server - somehow refresh the cached classes context of my web-server. The options provided by Google on this dev server are quite limited and am wondering if there's a better way.
I would like to avoid using something like JRebel which I could buy, but for this simple project I'm just wondering if I can remove the burden of restarting my web-server... otherwise I'll live with it.
I realized that you can just touch
appengine-web.xml to force server context reload. Also loading the
page under /_ah/reloadwebapp will reload the servers context - even if
it gives you a 404, it will still reload the context.
In debug mode, the JVM can perform some hot swapping - I know and Intellij IDEA does it, i m sure other debuggers in other IDE's does it too.
Start the app server with the debug flag (-Xdebug -Xrunjdwp:transport=dt_socket,address=127.0.0.1:8000 for example), then connect the debugger to the app server.
Then, make a change to the source that is not a method signature or class field change. Recompile, and voila, the debugger hot swapped the class into the jvm being debugged!
This only really works semi-well. But it may just be enough.

GWT Refresh Compile Cycle

According to what I have read concerning gwt, whenever we change the java code and reload the browser, the change is reflected. This is true for client side but not true for localhost serverside.
Does somebody know how to refresh the server side as well on browser refresh for gwt or is it not possible??
If you're executing your GWT webapp from Eclipse. You only need to go to the "Development Mode" tab and use the "Reload Web Server" option.
You can use hot deploy with Eclipse, Netbeans, IDEA etc. But for this usage you must use debug mode. In addition, IDE loses its state because of many changes so debug mode must be restarted.
I think there is no way to refresh changes and I think keyword is hot deploy
If your run GWT in Development mode within Eclipse, with a Spring backend Eclipse is usually clever enough to hot deploy server-side class changes, but not all of them.

Categories