How to create Maven Multi Module Project in Intellij?

28,295

Solution 1

Your presumption is correct, the top level project being pom packaging should have no source.

So start by removing (just delete or move elsewhere) the src folder from the top level (and everything under it... main, java, resources, text...)

Now, looking at your modules, they look correct. You can test they are configured properly by control-clicking them from the top pom, and they should navigate to the child pom's.

Lastly you want to set up a source structure under the child projects (which have war packaging). Manually create a folder structure under Employee module src\main\java, right click it and choose Mark As -> Source Root.

Do same for SkillSet and you're done.

Solution 2

I know you got your answer. This is for those who are using updated versions.

I am using Ultimate 2019.1. I had two spring boot projects generated from Spring Initializer. I created a directory where I kept my two sub-project and the parent pom.

Then I kept the cursor on /src/main/java of each project, right-click on the Java folder and choose Mark Directory as -> Generated Source Root.

These solved my problem.

Share:
28,295
Aravind E
Author by

Aravind E

Updated on February 13, 2020

Comments

  • Aravind E
    Aravind E about 4 years

    I am using IntelliJ IDEA Community Edition 2016.1.3. I'm trying to create a maven multi module project. Project company is the parent and Project employee and Project skillset are child modules. Project employee and skillset will have packing as a WAR but Project company has packing as POM.

    enter image description here my project structure look like this (above), but i need my project structure to be like below image enter image description here

    and I could not create a class under employee and skillset. How can I create a multi module project without having src folder in parent (company)?