Eclipse vs IntelliJ Hot Deploy

My application config: Tomcat 8, Spring, Spring MVC, Hibernate.

In Eclipse, I created a Tomcat Server with my app added to resources. JSP, JS, CSS and JAVA Hot Deployment Classes work just like this.

In IntelliJ, I have configured Tomcat 8 Server. On the Deployment tab I added myapp:war exploded

. I included On 'update' action

in Update classes and resources

, also I included On frame deactivation: Update classes and resources

. JSP, JS, CSS hot swap works just like that. Java classes are not.

I also checked Settings > Build, exection, deployment > Compiler > Make project automatically

PS. I know I can use JRebel, but in Eclipse, hot deploy works without JRebel. Why doesn't this work in IntelliJ?

+3


source to share


3 answers


First of all, the function name is not hot, but HotSwap. This is a JVM feature, not an IDE. IDEs simply automate the process and automatically launch the HotSwap of the modified class when there is a new version of the class. HotSwap is limited only to changes that can be made to the body of an existing method.

In IntelliJ go to Settings-> Debugger-> HotSwap and check the settings:

HotSwap settings

Enable the Update classes in background checkbox and then you can choose the behavior if the ID framework asks you how to disable classes, disable hot swapping, or never disable classes.

You need to compile manually. But, if the application is deployed from an "artifact", then "Project execution automatically" works for the running application, even if it says the opposite ("Settings" β†’ "Compiler"). However, the inconvenience is that the automatic compilation is delayed to start, so it is not as fast as you might expect. Compiling by hand is as easy as pressing CTRL+ Sin Eclipse, just CTRL+ F9/ CMD+ F9to make the project (which is actually incremental) or CTRL+ SHIFT+ F9/ CMD+ SHIFT+ F9if you want to compile a single file.

I would recommend JRebel for a better experience as it has gone far beyond what HotSwap can do and it integrates with a lot of Java frameworks to eliminate redeployments. And yes, I am biased - I work for ZeroTurnaround and I am developing JRebel.



UPDATE:

The original question was rather about automatically redistributing the web application in Tomcat / IntelliJ In the Run configuration, you can configure what should be done for the Update action:

Update action

The "Refresh" action is called manually. CTRL+ SHIFT+ A/ CMD+ SHIFT+ Aand search for "Update":

enter image description here

So relocation is a manual one-click process in IntelliJ.

+7


source


In IJ you can install the eclipse compiler instead of the default javac compiler, but still you have to do it manually.



+2


source


Did you notice the comment in IJ next to "Make project automatically"?

only works when running / debugging

To redeploy just do Ctrl+ F9(make) or Ctrl+ Shift+ F9(create the current file).

-1


source







All Articles