Container synchronization


I was wondering if IDEA has a server synchronization functionality like Eclipse. I'm not talking about anything fancy like JRebel, just replacing/redeploying a web app when changes to the source code occur.

If I'm developing a web application targeting Tomcat for example, I can have Eclipse to automatically "hotswap" resources and classes once any changes were made. Of course, it will redeploy on class changes in order for those changes to take place but I'm fine with that.

In IDEA, I've only been able to get half way there. I've configured the Run for my server to deploy an exploded artifact AND to trigger refreshes on class/resource changes when the frame is de-activated.

The way IDEA implements this feature is missing a couple of things Eclipse does:

1. Is there a way to make IDEA automatically trigger a redeployment when changes are made to java code? I see intellij moving the newly built classes to the deployment folder but its not smart enough to trigger the redeployment of the web app (which is needed in this case). Eclipse seems to be smart enough to simply update files when they're simple resources and update/redeploy when they're java classes.

2. Are there any display cues to show whether the deployment server and Intellij are currently in sync? Eclipse has a displaynicon that displays the current status (synchronizing, synchronized, etc).

Thanks in advance.

Comment actions Permalink

See .

Classes should be hot swapped automatically on frame deactivation or manual Make/Update. If it doesn't happen, please provide a sample project and the steps to reproduce.

You will get a popup saying how many classes were reloaded.

Comment actions Permalink

Classes do get hotswapped BUT no redeployment gets triggered, so the changes never really take place.

Comment actions Permalink

In most cases you don't need redeploy when classes are hotswapped (make sure to use Debug, not Run). If you do, change Update action to Redeploy instead of Update classes and Resources:

You can also trigger undeploy/deploy manually:

Comment actions Permalink

Thanks a lot Serge. I'm actually running under the regular "Run" not "Debug". I'm also not talking about the JVM hotswap, rather the synchronization of code between a server like Tomcat and intellij.

The behavior I have under Eclipse that I would like to replicate under Intellij is:

1. For non-java classes (regular resources):
     If code is modified, then automatically copy those files over to the deployment directory. Do not redeploy because it's not needed.
2. For java classes:
     if code is modified, then automatically copy those files over to the deployment directory AND redeploy because it's needed.

Basically, I want intellij to always copy files on frame de-activiation BUT redeploy ONLY when its java classes that were changed.

If I follow your steps then it will redeploy in both cases, which is not really needed.

I guess what I want in that "On 'Update' action" dropdown is to have another option:
     "Update classes and resources AND redeploy after updating classes"

Comment actions Permalink

You can use Update action with redeploy mode and automatic update on frame deactivation with update resources option.

I'd also try Update classes and resources option in Debug mode, in this case you may not need to redeploy.


Please sign in to leave a comment.