Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add module in Intellij 14 to existing project

Recently moved to Intellij from eclipse it seems to be tough to have this setup in intellij 14. enter image description here

Note: I cannot use maven

Steps I have followed created a "test project" and "test project 2"
-> opened test project project structure in cmd+; (shortcut in mac)
-> in project settings modules clicked on "+" and selected "import module" option
-> selected project 2

-> I got this error message stating that

cannot save settings, must not contain source root /test/src. The root belongs to module test`

This link is more confusing , could not understand much https://www.jetbrains.com/idea/help/configuring-content-roots.html

Can any one explain how to solve this?

like image 781
forum.test17 Avatar asked Jan 08 '23 08:01

forum.test17


1 Answers

Eclipse's concepts of "workspace" and "project" are matched by IntelliJ IDEA's "project" and "module" respectively. So to achieve similar setup as in your screenshot, create an ampty project, and import the modules "core", "model". .. to it.

Then open the "File > Project Structure" and check and adjust each module's "sources" and "test sources' folder. Make sure no source or test source overlap (this is the reason you got the "cannot save settings" error).

See for example the screenshot below. The project is called "test" and is in "C:\Projects\test". The module "springapp" is in "C:\Projects\test\springapp", its sources are marked "C:\Projects\test\springapp\src", its test sources are "C:\Projects\test\springapp\test". The same for the other modules.

Especially note that no one of the modules marks the root folder "C:\Projects\test\" as a "sources" or "test sources" (As I wrote above this is the reason for the error you got).

enter image description here

like image 154
Ivaylo D. Ivanov Avatar answered Jan 11 '23 01:01

Ivaylo D. Ivanov