Skip to content

Commit

Permalink
Updated hotswap-agent.adoc to include Copilot and IDE Plugin information
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcinVaadin committed Nov 25, 2024
1 parent c3fbc54 commit 1c7f6f0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions articles/flow/configuration/live-reload/hotswap-agent.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ JetBrains Runtime offers hotswapping of any type of Java changes into a running

In addition to getting the Java changes into the running JVM, most frameworks have some global data that needs to be updated when a class changes -- or some caches that need to be cleared for the new class to take effect. HotswapAgent is a collection of plugins for various frameworks, which offers these kinds of global updates and cache clearing when needed.

Setting up hotswapping consists of three steps:
Manual setting up hotswapping consists of three steps:

- Install JetBrains Runtime;
- Download HotswapAgent and install it into JetBrains Runtime; and
- Run the application using JetBrains Runtime with additional parameters.

All above can be done automatically using Vaadin Copilot together with Vaadin IDE Plugin.

== JetBrains Runtime

Expand Down Expand Up @@ -45,6 +46,13 @@ In the same dialog you need to click menu:Modify options[Add VM options] to be a

If you have another type of application, you'll need to pass the JVM options in the appropriate way.

== Using Vaadin Copilot and Vaadin IDE Plugin

Copilot provides *Development Workflow* guide which helps to set up development environment including hot swap solution. Depending on project setup and used IDE, Copilot will download proper version of JDK and suggest to proper Vaadin IDE Plugin.

Debugging application using *Debug using HotSwap Agent* from Vaadin IDE plugin will automatically check if you are using proper JDK, check if HotSwap Agent is available and apply additional required JVM arguments.

Vaadin IDE Plugin also provides *Compile on save* option which can be enabled in IDE settings (may differ depending on IDE).

== Testing

Expand All @@ -70,8 +78,6 @@ Don't launch the Maven `spring-boot:run` target as that forks another JVM proces

By default, any change in the Java code causes the application to reload in the browser. This is convenient when you make changes to the initial layout, constructors, post construct methods or similar. However, if you're modifying the logic inside a listener, there's no need to do a page reload for the change to take effect.

You can turn off reloading in the Vaadin Copilot in the [guilabel]*Info* panel. It can be more efficient to disable live reload, and manually reload the browser when needed. This is especially recommended when editing code related to a dialog or some other UI part which isn't mapped directly to a URL.

IntelliJ doesn't by default compile a Java file when you save it. If your habit is to press the compile shortcut, hotswapping works fine. Otherwise, you might want to set IntelliJ to build the project when you save. You can do that through menu:Settings[Build, Execution, Deployment > Compiler > Build project automatically]. You'll also need to ensure that the build takes place when the application is running in debug mode. This is done through menu:Advanced Settings[Allow auto-make to start even if developed application is currently running]. Finally, through menu:Settings[Build, Execution, Deployment > Debugger > HotSwap], [guilabel]*Reload classes after compilation* should be set to [guilabel]*Always*.


Expand Down

0 comments on commit 1c7f6f0

Please sign in to comment.