Adding an existing maven project as a module to another (maven) project

Hi,

I have a project, created by opening its POM file (from an existing source), that represents my service.
That service is dependent on a library. The library project is a maven project, too.
In the past, I worked on both in seperate windows, so there are IntelliJ project files for both, service and library.
To facilitate with debugging, I'd like to open the library project as part of the service project.

What I did was File > New > Module from existing sources...
I then selected the library's iml file.

The library was added as a module, but its Java files had a strange file icon in the explorer view:
https://www.jetbrains.com/img/webhelp/idea/classTypeJavaOutOfSourceRoot.png
I subsequently removed the module again, then opened the Mavan Projects pane from the service project, and hit the plus button:
https://www.jetbrains.com/img/webhelp/idea/new.png
It then recognised the classes as expected:
https://www.jetbrains.com/img/webhelp/idea/classTypeJavaClass.png

Why did the first approach "not work" and what are the differences between adding projects as modules one way or the other?

Brgrds,

Christian

Please sign in to leave a comment.