Eclipse与IntelliJ Hot Deploy [英] Eclipse vs IntelliJ Hot Deploy

查看:156
本文介绍了Eclipse与IntelliJ Hot Deploy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序配置:Tomcat 8,Spring,Spring MVC,Hibernate。



在Eclipse中,我创建了Tomcat Server,将我的应用程序添加到资源中。
JSP,JS,CSS和JAVA类热部署就是这样。



在IntelliJ中,我配置了Tomcat 8服务器。在部署选项卡中,我添加了 myapp:war explosion
我启用了在'更新'操作更新类和资源,我启用了关于帧停用:更新类和资源
JSP,JS,CSS热插拔工程就是这样。 Java类不。



我还检查了设置>构建,部署,部署>编译器>自动创建项目



PS。我知道我可以使用JRebel,但是在没有JRebel的Eclipse热部署中。为什么在IntelliJ中不起作用?

解决方案

首先,功能的名称不是热部署,而是HotSwap 。它是JVM的一个功能,而不是IDE。 IDE可以自动化进程,并在有新版本的类可用时自动触发已更改类的HotSwap。 HotSwap仅限于可以对现有方法进行更改。



在IntelliJ中,转到Settings-> Debugger-> HotSwap并检查设置:





启用在后台重新加载类复选框,然后您可以选择该行为,如果IDE要求您关于hotswapping类,默认hotswap或从不houpwap类。 / p>

你必须手动编译。但是,如果应用程序从artifact部署,那么自动创建项目适用于正在运行的应用程序,即使它表示相反(设置 - >编译器)。不便之处在于自动编译会延迟触发,因此不会像预期那样即时。手动编译就像在Eclipse中按 CTRL + S 一样简单,只需 CTRL + F9 / CMD + F9 使项目(实际上是增量式)或 CTRL + SHIFT + F9 / CMD + SHIFT + F9 如果要编译单个文件。



我仍然建议 JRebel 改善体验,因为它远远超越了HotSwap可以做的事情,它与大量的Java框架,以消除重新部署。是的,我有偏见 - 我为ZeroTurnaround工作,我参与了JRebel开发。



更新:



最初的问题是更多关于在Tomcat / IntelliJ
中的Web应用程序的自动重新部署在运行配置中,您可以配置,更新操作应该做什么:





手动调用'更新'动作。 CTRL + SHIFT + A / CMD + SHIFT + A ,并搜索'更新':





所以,IntelliJ中的重新部署是一个相当一键式的手动过程。


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?

解决方案

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.

这篇关于Eclipse与IntelliJ Hot Deploy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆