Updating applications on application servers
If you need to modify your application's source code while it is running on an application server, restarting the server to apply each change is usually not a practical solution. To make it easier to review your changes, IntelliJ IDEA provides several update policies that let you control how much of your application gets reloaded when you trigger an update.
Update a running application
You can trigger an update of your application only while its application server run configuration is running, whether in regular mode or in debug mode.
Open the Update dialog in one of the following ways:
Press Ctrl+F10.
In the main menu, go to .
In the main toolbar's run widget, click
Rerun or
Restart Debug.
In the Services tool window (Alt+8), click
Update application.
In the dialog, select an update policy and click OK.
Set up default application update policies
You can set up the default update policies for your application in its application server run configuration.
Open the Run/Debug Configurations dialog:
In the main toolbar, click the run widget and select Edit Configurations….
Alternatively, go to .
On the left side of the dialog, select your application server run configuration.
On the right side of the dialog, configure the following fields:
On 'Update' action: Select which update policy the IDE should run when you trigger an application update.
Show dialog:
If you want the IDE to display a dialog with available update policies every time you trigger an update, select this option.
If you want to skip the dialog and automatically run the policy from the On 'Update' action field instead, clear this option.
On frame deactivation: Select which update policy the IDE should run when you switch from IntelliJ IDEA to a different window (for example, a web browser).
Click Apply and then OK.
Available application update policies
This chapter describes all update policies that IntelliJ IDEA supports for applications running on application servers. The policies available to you depend on your run configuration type (local or remote) and artifact type (exploded or packaged). Some policies are only available in debug mode.
Update policy | Description | Artifact type |
|---|---|---|
Update resources | Update modified resources (such as HTML, JSP, JavaScript, CSS, or images) in the artifact directories. | Exploded |
Update classes and resources | Recompile modules included in the artifacts and update the modified resources and classes (including EJBs, servlets, and so on) in the artifact directories. If the application is in debug mode, IntelliJ IDEA uses HotSwap for classes and updates them in the JVM instead of the artifact directories. | Exploded |
Hot Swap classes (debug mode only) | Recompile modules included in the artifacts and update the modified classes in the JVM using HotSwap. | Packaged |
Redeploy | Rebuild the application artifacts and redeploy them to the server. This policy may be time-consuming. | Exploded and packaged |
Restart server | Restart the server, rebuild the application artifacts, and redeploy them to the server. This policy may be very time-consuming. | Exploded and packaged |
Update policy | Description | Artifact type |
|---|---|---|
Hot Swap classes (debug mode only) | Recompile modules included in the artifacts and update the modified classes in the JVM using HotSwap. | Exploded and packaged |
Redeploy | Rebuild the application artifacts and redeploy them to the server. This policy may be time-consuming. | Exploded and packaged |