Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to mark/import subfolders as Maven projects in IntelliJ?

I have imported a project from git, where topmost folder does not contain any pom file. It has src folder and some java files under it's tree.

Simultaneously, it has several subfolders with pom files in each.

How to force IntelliJ think these are projects?

like image 825
Suzan Cioc Avatar asked Jun 28 '15 12:06

Suzan Cioc


People also ask

How do I import multiple modules in IntelliJ?

From the main menu, select File | New | Module from Existing Sources. In the dialog that opens, specify the path the . iml file of the module that you want to import, and click Open. By doing so, you are attaching another module to the project without physically moving any files.


2 Answers

How to force IntelliJ think these are projects?

You can add them as modules to your IDEA project. Open the Maven tool window and use the add button enter image description here to add them.

If you want each to be a separate IDEA project, then simply use File > Project from Existing Sources for each one and select the pom file.

like image 103
Javaru Avatar answered Sep 20 '22 11:09

Javaru


You can also think about creating a "super pom" file in the root, which has a <modules> section which specifies the sub folder of each of the various modules, containing their own pom.xml files.

The packaging of the super pom should be pom.

If the sub module pom.xml files are configured with a parent to the super pom, you can centralise configuration properties in one place, as well as being able to build all the modules by simply building the parent pom.

like image 34
vikingsteve Avatar answered Sep 22 '22 11:09

vikingsteve