Java Hot code replace ( HotswapAgent + DCEVM )
Zdravo fellow java developers! Lets save some time :)
One of the most irritating aspect of coding in large java project is redeploying code. For some projects it might take upto 5 mins (maybe more)! And this has to be done for every small change and this is time consuming. With DCEVEM and Hotswap agent we can dynamically hot replace the code instantly.
To set it up we need to install DCEVM into our JRE.
- Download the DCEVM binary from http://dcevm.github.io/
- run: sudo java -jar installer.jar.
- Click on add installation directory and select your java home folder
4. Click on install DCEVM as altjvm.
Now we need to install hotswap agent in IntelIj.
5. Add the hotswap plugin in intellij and keep the options as shown below.
6. Now Download hotswap agent jar from here.
mvn spring-boot:run -DskipTests -Drun.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address= 5005 -XXaltjvm=dcevm -javaagent:/path/to/hotswap-agent.jar"
8. To hotswap the code, make sure you have a remote debug connection from intellij and then press cmd + shft + F9 (compile).
9. Done !!!!!
PS: Not all types of changes can be hot replaced. http://hotswapagent.org/