Hot Reload Spring Project
11 October 2018
Commercial tool JRebel does great but too expensive, around $550/license/year. So, another free solution HotswapAgent is better for team. However, it needs more extra steps to setup, not as easy as a pie like JRebel.
- Java 1.8.0_31 -> DCEVM-light-8u45-installer.jar (Try until column ‘Installed altjvm’ says YES)
How to install
- Download release of DCEVM Java patch based on Java version and launch the installer (e.g. sudo java -jar installer-light.jar). Currently you need to select correct installer for Java major version (7/8).
- Select java installation directory on your disc and press “Install DCEVM as altjvm” button. Java 1.7+ versions are supported.
- 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
-XXaltjvm=dcevm -javaagent:PATH_TO_AGENT\hotswap-agent.jarto VM options
- Preferences -> Build, Excecution, Deployment -> Debugger -> Hot Swap:
- Check “Build project before reloading classes’
- Check “Reload classes in background”
- Choose Always on Reload classes after compilation
-XXaltjvm=dcevm -javaagent:/sourcecode/hotswap-agent-1.3.0.jarto VM options in Configuration
- Press Command + Shift + F9 (Build -> Recompile …) to reload only current file, or Command + F9 (Build -> Build Project) to reload whole project
- Change keymap:
- Preferences -> Keymap -> Search for ‘Compile’, then change Command + Shift + F9 to Command + Shift + S to recompile easier
blog comments powered by Disqus