Adding multiple portal modules

What is the correct way to add multiple portal modules? I’ve tried adding through intellij, but I can’t seem to get it to add it to the existing project.

Here is an example of the project with two portal modules: https://github.com/gorbunkov/sample-two-portals

The second portal is accessed by the URL: http://localhost:8080/app-second-portal

I created in the following way:

  1. Created a new project with the portal module.
  2. Created a copy of the portal directory and named it second-portal
  3. In the build.gradle file, looking at the configuration for the portal module, I created similar records for the second-portal module.
    WARN: in the configure(secondPortalModule) { section add additional line:

appModuleType = 'portal'
  1. Registered new module in the settings.gradle
  2. In the portal-app.properties file of the new module I changed the value of the property:

cuba.webContextName = app-second-portal
  1. In the web.xml of the new portal module I changed the path to the local.app.properties file