Skip to content

Latest commit

 

History

History
49 lines (37 loc) · 2.59 KB

idea_tomcat_setup.md

File metadata and controls

49 lines (37 loc) · 2.59 KB

IntelliJ IDEA + Tomcat Project Setup Guide

By configuring Tomcat with IntelliJ, you can manage key aspects of your development process, such as debugging, logs and hot swapping, all from within the IDE.

This guide assumes you have already installed Tomcat on your machine. Additionally, the Maven, Tomcat and Java EE plugins are required, but they come bundled with IntelliJ and are enabled by default. Unless you have manually disabled them, your environment should be ready.

To ensure a smooth setup, follow these steps to configure your project in IntelliJ:

  1. Build with Maven. Run the following commands from the command line:

    • mvn clean install -f dhis-2/pom.xml -DskipTests=true

    if you are using version 2.41 or older, run this command too:

    • mvn clean install -f dhis-2/dhis-web/pom.xml -DskipTests=true
  2. Import Project to IntelliJ:

    • Continue by importing the project from your local sources into IntelliJ.
  3. Add as Maven Project:

    • Right-click on the project's pom.xml and select "Add as Maven Project".
  4. If you are on 2.41 or older, configure the Maven Project:

    • In the plugin list on the right side, click on Maven.
    • Add the web portal project to the list of Maven projects.
    • Make sure it's part of the list of modules in /File/Project Stucture/Modules. If it's not, add it to the list.
  5. Configure Local Tomcat:

    • Open the configurations menu and add a new local Tomcat configuration.
      1. From 2.42 on, you'll need at least Tomcat 10.
      2. Up until 2.41, use Tomcat 9.0.96 and below.
    • In the Deployment tab:
      1. From 2.42 on, add the artifact named dhis-web-server:war exploded.
      2. Up until 2.41, add the artifact named dhis-web-portal:war exploded. This will automatically select this artifact for build before launch.
  6. Configure Tomcat Settings:

    • Navigate to the Server tab.
    • Choose an available port in your local URL.
    • In both options on update action and on frame deactivation, select update classes and resources if you need to enable hot swap functionality.
  7. Set Environment Variable:

    • In the Startup/Connection tab, add a new environment variable called DHIS2_HOME. Repeat this action for the Debug profile too.
    • Set the value to your configuration file.
  8. Configure Logging (optional):

    • Go to the Logs tab and click on Save console output to file.
    • Choose a file, preferably the Catalina file of your local Tomcat, to store logs.