My app configuration: Tomcat 8, Spring, Spring MVC, Hibernate.
In Eclipse I created Tomcat Server with my app added to resources. JSP, JS, CSS and JAVA classes hot deploy works just like that.
In IntelliJ I configured Tomcat 8 Server. In Deployment tab I added myapp:war exploded
.
I enabled On 'update' action
to Update classes and resources
, also i enabled On frame deactivation: Update classes and resources
.
JSP, JS, CSS hot swap works just like that. Java classes not.
I have 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 it does not work in IntelliJ?
A: Eclipse is better than IntelliJ for large and complex projects. This is because it indexes the entire project during startup. IntelliJ IDEA, however, outshines Eclipse when it comes to dealing with existing projects. In this case, IntelliJ IDEA delivers better performance than Eclipse.
The more plugins installed in the IDE make it more heavy for your computer. However, Eclipse handles the large projects faster as compared to IntelliJ Idea because it indexes the entire project on start-up. But, when you are working on an existing project, IntelliJ Idea works faster and smoother as compared to Eclipse.
Eclipse falls short in providing good assistance for code completion despite supporting many plugins. The default code compilation in IntelliJ is much faster and better, especially if you're a newbie programmer – IntelliJ can help you improve your code.
First of all, the name for the feature is not "hot deploy" but HotSwap. It is a feature of JVM and not of an IDE. IDEs just automate the process and trigger the HotSwap of the changed class automatically when there's a new version of the class available. HotSwap is limited only to the changes that can be made to a body of an existing method.
In IntelliJ, go to Settings->Debugger->HotSwap and check the settings:
Enable Reload classes in background checkbox and then you can choose the behaviour, should the IDE ask you about hotswapping the classes, hotswap silently, or never hotswap the classes.
You do have to compile manually. But, if the application is deployed from an "artifact", then "Make project automatically" works for the running application even though it says the opposite (Settings -> Compiler). The inconvenience though is that automatic compilation triggers with a delay, so it is not as instant as one would expect. Compiling manually is just as simple as pressing CTRL+S in Eclipse, just CTRL+F9/CMD+F9 to make the project (which is actually incremental) or CTRL+SHIFT+F9/CMD+SHIFT+F9 if you want to compile a single file.
I'd still recommend JRebel for improving the experience since it goes far beyond what HotSwap can do and it integrates with a large number of Java frameworks to eliminate redeploys. And yes, I'm biased - I work for ZeroTurnaround and I'm involved with JRebel development.
UPDATE:
The initial question was rather more about the automatic redeployment of the web app in Tomcat/IntelliJ In Run configuration, you can configure, what should be done for the 'Update' action:
The 'Update' action is invoked manually. CTRL+SHIFT+A/CMD+SHIFT+A, and search for 'Update':
So, redeployment is a rather "one-click" manual process in IntelliJ.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With