Loading repository data…
Loading repository data…
xxxtai / repository
This repo is a plugin of Intellij IDEA that can help you achieve hot swap without any configuration and debugging.(一种简单快捷的实现Java热部署方式,使用该IntelliJ IDEA插件进行远程服务器热部署无需任何配置,无需使用debug端口,只需几个简单动作就能完成)
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
Sometimes, when you're making minor changes to your code, you want to immediately see how they will behave in a working application without shutting down the process. As we all know, hot swap can be achieved through debugging. But in some cases, the debugging port is restricted due to permission control, then you will not be able to achieve HotSwap through debugging.
The IntelliJ IDEA plugin introduced in this article can help implement hot swap on a remote server, and the operation is simple and fast. The plugin in this article is based on Arths redefine command.
Usually you can use it directly without configuration. In some special cases, you need to config "the absolute path of java command" or "specify the full path calss name of Java process" according to the application configuration. Configuration: “IntelliJ IDEA(Top Left Corner)” -> "Prefrences" -> “Tools” -> “ArthasHotSwap”。
HotSwap uses bytecode files, so first, we need to compile related projects, in the future, we can only compile the modified files to save time.
Find the files(.java or .class) that need to be modified by HotSwap, right click in the IDEA, choose “ArthasHotSwap” and click “Swap this class”. When the plugin is successfully executed in the background, the plugin will copy the command required for HowSwap to the pasteboard.

Next you need to log in to your remote server, then paste the command form the clipboard and execute it with administrator privileges. If the first execution fails, please execute again. Due to the need for Alibaba Cloud OSS as a medium to transfer bytecode files, your remote server needs to be able to access to the Alibaba Cloud Server.


Due to VM design, HotSwap has the following limitations:
it is only available if a method body is modified. Changing signatures is not supported.
adding and removing class members is not supported.
if the modified method is already in the call stack, the changes will take effect only after the program exits the modified method. Until that moment, the method body remains unchanged, and the frame is marked as obsolete.
Arthas is a Java diagnostic tool open-sourced by Alibaba middleware team. Arthas redefine is realized on the basis of Instrumentation API. The plugin uploads bytecode files to the remote server with the help of OSS, and reload classes changed with Arthas redefine.