Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force intelliJ to import a maven dependency with classifier as a "Maven Library" instead of "Intellij Module"

In my maven based IntelliJ project I have 2 modules - modules A and B.

  • The pom.xml of module A creates an uber jar (including dependencies which are not accessible by the project) and attaches it as an artifact with classifier "withdeps"
  • The pom.xml of module B has a dependency on the classified "withdeps" artifact A

When I import the maven modules IntelliJ adds the module's A source code in the dependencies of module B (ignoring the "withdeps" classifier).

Is it possible to force Intellij to add the module A dependency to B as "maven library" instead of the default "project source code/Intellij module"? If not what can I do to resolve the compilation errors in IntelliJ (Ctrl+F9)

Thanks

like image 943
Kostas Avatar asked Mar 01 '14 23:03

Kostas


1 Answers

Open the pom.xml of module B only when creating the intellij project. Then all dependencies will be as maven dependencies.

The downside is that this way you will have to open module A as separate project in another window, then when you change something you will have to do mvn install and refresh project B.

Much better solution would be to install all depencencies into maven repository, described here in maven docs.

like image 199
František Hartman Avatar answered Sep 25 '22 07:09

František Hartman