Working with Server Run/Debug Configurations
To run or debug your Java EE or Web application on an application server, 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
- What happens when a server run configuration is started
- Creating a server run/debug configuration
- Starting a server run/debug configuration
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, starts 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 connects 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 means of the corresponding run configuration.
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 tasks. By default, these are Make and Build Artifacts: IntelliJ IDEA compiles the project and builds the application artifacts. The Build Artifacts task 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 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 Dialog).
See also, Create and Edit Run/Debug Configurations.
Starting a server run/debug configuration
Alternatively, you can use the Services tool window.