Maven profile dependency


I have a module with two profiles, each with its own set of dependencies. Now I want to write a class (A) wich uses other class (B) from another project's module (M) which is added as dependency in one of the profiles. I have that profile ticked in "Maven project" under profiles. But when I declare variable of type B in class A idea first offers me to add a dependency to module M. If I let it add that dependency, it adds it to main dependencies list, not to profile,  so it is present twice in pom, fist in main deps and then in profile, and then seems happy (A compiles). And it continues to compile even if I remove that added dependency. Is it a bug in idea or I'm doing something wrong?

Best regards, Eugene.

Please sign in to leave a comment.