Seeing links of class names to class files in different jars

已回答

If I print the full class name with its package (and a line number), IntelliJ autolinks this class name to the class file (like when "at" is printed in an exception).
But IntelliJ doesn't link to the class if its on a different jar (not in the source).
I have a project, that links to other projects via maven (they can't be modules). How can I see what class is it in an autolink (and not via class name finder)?

0

You can navigate to the jars if they are in the classpath of the project. If the jar has the sources attached, you'll get directly to the sources, otherwise IntelliJ IDEA will use the decompiler.

If it doesn't work for you, provide the sample project to reproduce.

0

The jar is on the pom in maven, not in the classpath directly. It has its sources in .m2 folder. 

0

Navigation will only work to the jars that are in the classpath of the project, it's by design. IDE doesn't keep the index and locations of all the jars you have on disk to provide the navigation (also how that would work if multiple versions of the jars are available? IDE needs the direct location of the jar linked from the project).

0

But if I used maven? Doesn't the IDE know with what JARS my project got built?
It doesn't need to know every JAR on my disc, only the JARS used to build my project.

0

It knows the jars defined in pom.xml as the dependencies and listed in the module dependencies: https://www.jetbrains.com/help/idea/2017.1/working-with-module-dependencies.html.

0

So it does know the jars needed. So the JAR doesn't have to be on the classpath - it just need to be on the pom.

0

Jars in the pom.xml dependencies are added to the classpath anyway, verify it yourself in https://www.jetbrains.com/help/idea/2017.1/working-with-module-dependencies.html.

0

But it doesn't autolink when printed...

0

Please share a sample project to reproduce.

0

Unfortunately, I can't. Is there any debug-info I give? Log?

0

请先登录再写评论。