HotSwapAgent-IntelliJ-IDEA-プラグイン
・ホットスワップ・
私たちの仕事は楽しいですが、最新の変更がアプリケーションサーバーにデプロイされるのを待つ時間を無駄にしたくありません!
Command+Shift+F9
IntelliJ IDEAのHotSwapメカニズムを使用して、アプリケーション全体を再起動することなく、デバッグ中に変更されたクラスをリロードできます。
BUT!
現時点では、Java SDKの元の制限によりHot
、メソッド本体が変更された場合にのみスワッピングが可能です。
他のすべての場合(メソッドやクラスシグネチャの変更など)では、クラスのリロードが行わimpossible
れ、対応するエラーメッセージが表示されます。
解決
変更されたクラスをリロードする機能を強化するには、JVMと一緒に特別なJavaエージェントを使用する必要があります。例えば:
-
JRebel(高すぎる$550
:恐ろしい:ユーザーあたり年間) -
スプリング式(java 8およびcrash JVM
:dizzy_face:では正しく機能しません。Springチームは「ファイル変更時にアプリケーションを再起動する」を伝播します-Spring Bootのspring-boot-devtoolsのアプローチ) -
FakeReplace(JDK10 +はまだサポートされていません) -
RelProxy(デッド?JDK8 +のサポートなし) - DCEVM(無料-オープンソース-本当に
hot
:grinning :)
DCEVM +ホットスワップエージェント:thumbsup:を選択します。
DCEVMのインストール
手順: |
---|
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 |
|
3. Download latest release of Hotswap agent jar, unpack hotswap-agent.jar and put it anywhere on your disc. For example: C:\java\hotswap-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). |
|
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. |
|
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
)