IntelliJ IDEA 2016.2 Help

Configuring Web Application Deployment

A Web application can be deployed to the server as an exploded directory where files and folders are presented in the file system as separate items or as a Web archive (WAR file) which contains all the required files. Therefore you need to configure the layout of your project output so it can be deployed to the server in one of these forms. In IntelliJ IDEA, the layout of a project output is defined through artifacts.

When you enable Web development in a module, IntelliJ IDEA configures an artifact of the type exploded with the following basic structure:

basic_artifact_configuration.png
You can use this pre-defined artifact, possibly with necessary customization, or configure a new artifact.

Configuring an artifact to deploy involves:

  1. Specifying the artifact type, name, and output directory.
  2. Adding static Web content resources.

The suggested deployment configuration procedure reflects the basic workflow which can be flexibly customized depending on your preferences and the requirements to a specific Web application.

To configure the basic artifact settings

  1. Open the Project Structure dialog box (Ctrl+Shift+Alt+S).
  2. Click Artifacts to open the Artifacts page.
  3. Do one of the following:
    • To use a pre-defined exploded directory artifact, select the <module name>war:exploded artifact from the list on the left-hand pane. If necessary, change the name and output directory of the artifact in the corresponding fields on the right-hand pane.
    • To create a new artifact, click the New toolbar button add.png on the left-hand pane and choose the artifact type from the New drop-down list.
      • To have the application deployed as a directory, choose Web Application: Exploded.
      • To have the application deployed in the packed form, choose Web Application: Archive.

    On the right-hand pane, specify the general settings of the artifact, such as name and output directory, in the corresponding fields.

To add static Web content resources

  1. Open the desired artifact and switch to the right-hand pane, the Output Layout tab.
  2. With the select the output root node selected, choose the Create Directory item on the context menu or click the Create Directory toolbar button icon_newFolder.png. In the dialog box that opens specify the name of the new folder, for example Resources:
    artifact_add_folder.png
  3. With the new folder selected, choose the Add Copy of item on the context menu or click the Add Copy of toolbar button add.png.
  4. On the context menu, choose the Directory Content item on the context menu. In the dialog that opens, choose the directory where the required Web content resources are stored.
    artifact_add_directory_contents.png

See Also

Reference:

Last modified: 23 November 2016