I have a big maven multi-module project. And when I load this project into IDEA, importing all the nexus dependencies, doing "mvn clean install" to populate the local repo, everything seems OK for maven, since it can successfully resolve everything. But in IDEA, some classes are displayed in red using the tooltip "cannot be solved ..."
The important point is that some packages of remote classes are packed in 2 or more jars (and not one, as is usually done) with the same .mf manifest (therefore with the same artifact name). They contain the same package, but one stores half of the classes and the other stores the latter. The scope of compilation.
It looks like we have 2 classes A and B in the com.pack1 package, and they are packed in 2 jars of foo.jar (contaning com.pack1.A.class) and foo-impl.jar (contaning com.pack1 .B.class) with an identical manifest.
It seems that maven handles this correctly, but not in IDEA: in the design structure there is only one jar of jar-bundle (one without additional name parts, such as "-impl" or "-web"). Therefore, some classes (from the remaining jars) are red and cannot be opened with ctrl + LMB or found with ctrl-N . There is only one bank in the local m2 repo (the same with the IDEA project settings).
The magic is that IDEA can still find the missing double-shift class and open the code as is (without warning decompilation). And if I open this class in the editor, scrolling from the source in the project structure pane does not work. It seems that IDEA somehow loads the class into the classpath into memory, but does not know where to find the corresponding jar in the file system. And this is really absent, because "There is only one bank also in the local m2 repo"
So my question is how can it be ? And how can I get IDEA and maven to be friends so that they act the same when handling dependencies?
(Excluding adding a missing banner to the project structure manually)
I tried to re-import to the right maven navbar, an invalid IDEA cache, clear the local m2 repository, re-import the entire project from a file → new → the project from existing sources, update the repositories in the settings → build, execute, deploy → build tools → Maven-> repositories and use another version of maven.
Maven 3.0.4, IDEA 17.1
source share