IntelliJ IDEA 2022.3 Help

Enable Web application support

With Web Application support, IntelliJ IDEA:

  • Creates a web resource directory web with index.jsp intended as a starting page of your app and, optionally, a web app deployment descriptor WEB-INF/web.xml.

  • Creates a Web facet that lets you manage your deployment descriptors, web resource directories and your Java web source roots.

  • Creates an Exploded WAR artifact configuration.

  • Makes the Web tool window available.

If you turn on the Web Application option when creating a project or module and specify an application server, IntelliJ IDEA also creates a run/debug configuration for that server.

Turn on the Web Application option

Create a new web application

  1. Click New Project on the Welcome screen or select File | New | Project.

  2. From the Generators list, select Jakarta EE.

  3. Name the new project, select a build tool, a language you want to use, and select the Web application project template.

  4. Select the Create Git repository option to place the new project under version control.

  5. From the JDK list, select the JDK that you want to use in your project.

    If the JDK is installed on your computer, but not defined in the IDE, select Add JDK and specify the path to the JDK home directory.

    If you don't have the necessary JDK on your computer, select Download JDK.

    Creating new Java Enterprise project
  6. On the next step of the wizard, select the Java Enterprise version to be supported.

  7. From the Dependencies list, select Servlet.

  8. Click Create.

Add the Web Application option an existing module

  1. In the Project tool window (Alt+1), right-click the necessary module and select Add Framework Support.

  2. In the dialog that opens, select Web Application and select a version of the Servlet specification.

  3. If you want the deployment descriptor web.xml file to be created, select the Create web.xml checkbox.

    Click OK.

Manage deployment descriptors, web resource directories, and Java web source roots

You can manage your web app deployment descriptors, web resource directories and Java web source roots in the Project Structure dialog:

  1. From the main menu, select File | Project Structure or press Ctrl+Alt+Shift+S.

  2. In the leftmost pane, select Modules or Facets.

  3. In the pane to the right, select Web or Web (<ModuleName>).

  4. On the page that opens in the right-hand part of the dialog:

    Deployment Descriptors. Form the list of deployment descriptors for your web app.

    Web Resource Directories. Specify the directories that contain your web app resources such as web pages, images, etc.

    Source Roots. Select the source roots that contain your web application Java classes (servlets, filters, managed beans, etc.).

    For more info, see Web facet page.

Manage application artifacts

To manage your artifact configurations, use the Project Structure dialog (File | Project Structure | Artifacts).

To deploy your application to a server, you need an application artifact. For Java web applications, IntelliJ IDEA provides the following artifact formats:

  • Web Application: Exploded. This is a decompressed Web application archive (WAR), a directory structure that is ready for deployment onto a web server.

  • Web Application: Archive. This is a WAR file.

Web application artifacts

See also, Artifacts.

Last modified: 16 June 2022