Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Intellij IDEA automatically replace Maven dependencies with module dependencies?

I'm working with a Java project in Intellij IDEA where we have a lot of internal, standalone, Maven dependencies. I have the source code for these dependencies imported into my IDEA project as modules, but when I select Go To -> Implementation(s) on a class that is part of an internal Maven dependency (and that I have also imported as a module in my project) I'm navigated to a decompiled view of the class in the Maven dependency (jar) and not the source code file of that class that I imported as a module.

To solve this I need to do the following:

  1. Open Module Settings on the module using the internal Maven dependency
  2. Find and remove the internal Maven module in the Dependencies list
  3. Add a new Module Dependency and then select the imported module that corresponds to the internal Maven dependency

Is there any way to have IDEA figuring out this automatically or do I have to do this manual procedure over and over?

like image 568
Erik R. Yverling Avatar asked Nov 13 '14 08:11

Erik R. Yverling


1 Answers

To add another maven project (that is not part of your main project) as a dependency:

  1. open you main project
  2. in Maven Projects Tool Window click on green + button and select pom.xml of a dependency
  3. repeat 2 as required

Source: https://www.jetbrains.com/idea/help/maven-projects-tool-window.html?search=maven%20project

like image 126
František Hartman Avatar answered Sep 21 '22 16:09

František Hartman