IDEA 热部署配置 HotSwapAgent-IntelliJ-IDEA-plugin
HotSwapAgent-IntelliJ-IDEA-plugin
hotswaplogo
·Hot Swapping·
Our work is fun, but we don't want to waste our time waiting when our latest changes will be deployed on application server!
You can reload classes changed during debugging without need to restart the entire application using the HotSwap mechanism Command+Shift+F9
in IntelliJ IDEA.
jvm_hotswap_ok
BUT!
At the moment due to original limitations of Java SDK the Hot
Swapping is possible ONLY if the method body is altered.
In all other cases (like changing method or class signature), the class reload is impossible
and the corresponding error message appears.
jvm_hotswap_fail
Solution
We need to use special java agent together with our JVM to enhance ability of reloading of changed classes. For example:
-
JRebel(too expensive$550
:fearful: per year per user) -
Spring-Loaded(cannot work properly with java 8 andcrash JVM
:dizzy_face:, the Spring team propagates the "Restart application on file-change"-approach of spring-boot-devtools for Spring Boot) -
FakeReplace(No JDK10+ support yet) -
RelProxy(Dead? No support for JDK8+) - DCEVM (free-opensource-really
hot
:grinning:)
We will choose: DCEVM + Hotswap Agent :thumbsup:
DCEVM Installation
steps: |
---|
1. Download latest release of DCEVM Java patch and launch the installer with sudo(e.g. sudo java -jar DCEVM-light-8u51-installer.jar). Currently you need to select correct installer for Java 8. |
2. Select java installation directory on your disc and press "Install DCEVM as altjvm" button. JDK version 1.8.0_45 is recommended. download here |
DCEVM |
3. Download latest release of Hotswap agent jar, unpack hotswap-agent.jar and put it anywhere on your disc. For example: C:javahotswap-agent.jar |
4. Installation is done! |
5. More info here |
Start with Hot
SwapAgent plugin for IntelliJ IDEA.
steps: |
---|
1. Install HotSwapAgent plugin for IntelliJ IDEA. |
[图片上传失败...(image-cda5ba-1601023884060)] |
2. Enable HotSwapAgent plugin for all configurations (or one by one). |
enable |
3. Start the application in DEBUG mode. You will see HOTSWAP AGENT notification in your console in case if setup was correctly done. |
[图片上传失败...(image-74bfa5-1601023884060)] |
4. Be sure that you have "Reload classes after compilation: Always" ON in IntelliJ IDEA in HotSwap section in your IDEA preferences. |
image |
5. To re-deploying changed classes in IDEA press keys combination (: Command+Shift+F9/ ⊞: Ctrl+Shift+F9) to compile the current file |
:information_source: Instead of compiling the classes manually you can use the Save Action plug-in, which can trigger the compilation automatically and thus enabling "hotswap on save".
Happy:heart: Hot
Swapping!
-
change
method name & then press (:Command+Shift+F9
/ ⊞:Ctrl+Shift+F9
) -
add new
method & then press (:Command+Shift+F9
/ ⊞:Ctrl+Shift+F9
)
change_02
More info: DCEVM & HotswapAgent
- java教程
- Java快速入门
- Java 开发环境配置
- Java基本语法
- Java 对象和类
- Java 基本数据类型
- Java 变量类型
- Java 修饰符
- Java 运算符
- Java 循环结构
- Java 分支结构
- Java Number类
- Java Character类
- Java String类
- Java StringBuffer和StringBuilder类
- Java 数组
- Java 日期时间
- Java 正则表达式
- Java 方法
- Java 流(Stream)、文件(File)和IO
- Java 异常处理
- Java 继承
- Java 重写(Override)与重载(Overload)
- Java 多态
- Java 抽象类
- Java 封装
- Java 接口
- Java 包(package)
- Java 数据结构
- Java 集合框架
- Java 泛型
- Java 序列化
- Java 网络编程
- Java 发送邮件
- Java 多线程编程
- Java Applet基础
- Java 文档注释
- 【C++】八皇后问题(竖列递进)
- Koom流程记录(一)
- FTP文件管理项目(本地云)项目日报(关于不定长包的测试)
- 指针传参解惑(3)
- 学以致用设计模式 之 “组合模式”
- 学以致用C++设计模式 之 “观察者模式”
- 学以致用C++设计模式 之 “门面模式“
- 学以致用C++设计模式 之 “状态模式”
- 学以致用设计模式 之 “享元模式”
- 程序员必备数据结构:堆
- 程序员必备数据结构:栈
- 【C++ STL】停下你到处找 hash_map 使用教程的手,看我的就好了
- 【C++】同样是讲解逆波兰式,为何这篇就图文并茂,通俗易懂呢?
- 学以致用C++设计模式 “建造者模式”
- 你会不会处理多线程中的对象管理?