Working with Server Run/Debug Configurations
To run or debug your Java EE or Web application, you need an application server run/debug configuration.
One such configuration may be created by IntelliJ IDEA automatically. This happens if you, when creating a project or module, specify an application server that you are going to use (see Defining a server when creating a project or module).
You can create more server run/debug configurations if and when needed.
Local and remote run configurations
A server run/debug configuration may be local or remote.
Local configurations are for servers installed on your computer. Such configurations include the settings that define how the corresponding server is to be started. Consequently, when you execute a local configuration, IntelliJ IDEA, among other things, will start the server.
Remote configurations don't start a server. Usually, they are used for servers running on different (remote) computers. They may as well be used for servers installed locally (on your computer) in cases when you don't want the run configuration to start (or stop) the server.
When you execute a remote configuration, IntelliJ IDEA will connect to the server to be able to deploy application artifacts or to perform their debugging. At that time, the corresponding server must already be running.
To conclude, what principally distinguishes local and remote configurations is not where the server is physically installed (though this is also important) but whether or not the server is started (or stopped) by IntelliJ IDEA or by other means that are external to IntelliJ IDEA.
What happens when a server run configuration is started
When you start a server run/debug configuration, IntelliJ IDEA, usually, does the following:
- Performs the Before Launch actions. By default, these are Make and Build Artifacts actions. (That is, IntelliJ IDEA compiles the project and builds the application artifacts. The Build Artifacts action is not initially present in a run configuration but added automatically as soon as you specify the artifacts to be deployed onto the server.)
- Starts the server (for a local configuration) or connects to the server (for a remote configuration). (At that moment, the Run or the Debug tool window opens so that you can monitor and control the process.)
- Deploys the specified artifacts (and/or deployable components external to your project) to the server.
- If so specified, starts a default web browser and opens a specified URL (which usually corresponds to a starting page of your application).
Creating a server run/debug configuration
- Open the Run/Debug Configurations dialog (e.g. Run | Edit Configurations).
- Click (Alt+Insert), select the server of interest (e.g. Tomcat Server) and, if available, select Local or Remote. (See Local and remote run configurations.)
- In the right-hand part of the dialog, specify the run/debug configuration settings and click OK. (For information on the available settings, see the corresponding server-specific topic in Run/Debug Configurations).
Starting a server run/debug configuration
To open the Application Servers tool window, do one of the following:
- Select View | Tool Windows | Application Servers.
- Click Application Servers on the bottom tool window bar.
- Select the server run/debug configuration which you want to use.
On the toolbar of the tool window, click:
- to start the selected configuration in the run mode.
- to start the selected configuration in the debug mode.