Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can the IntelliJ external maven library tell where the dependencies are from?

I am using IntelliJ and maven for dependencies. From the External library, I could see the maven import dependencies.

enter image description here

Something like this, is that possible to know where these dependencies come from? I try to search for com.sun.xml: jaxb-core in the pom file but I can't find exactly that dependency. So is that possible to know where this single dependency comes from? Thanks!

like image 397
TryMyBest Avatar asked Dec 18 '22 00:12

TryMyBest


2 Answers

Follow the steps here, I am also attaching the screen shots for better understanding.

Important - this is for ultimate/paid version only

  1. Open your POM.xml in the editor -> right click in the editor area -> diagrams -> show dependencies, like below:-

alternatively use shortcut ctrl+alt+shift+U

enter image description here

  1. after this a separate window with some hierarchy will show up like below(sorry but for complex dependencies it actually shows up like this):-

enter image description here

  1. there you can search your dependency by typing ctrl+f and entering the dependency name like jaxb-core or anything upto your case, in my case i searched jackson-core

  2. After little zooming in, you can also click on the line arrows to check where it is coming from and do that until you want to check from which initial dependency is it coming from, refer the image below for this:-

enter image description here

like image 90
kakabali Avatar answered Jan 26 '23 16:01

kakabali


Use

mvn dependency:tree

Sample output for https://github.com/statsbiblioteket/streamtuples:

[INFO] --- maven-dependency-plugin:2.8:tree (default-cli) @ streamtuples-integration-test ---
[INFO] dk.kb.stream:streamtuples-integration-test:jar:0.5-SNAPSHOT
[INFO] +- dk.kb.stream:streamtuples:jar:0.5-SNAPSHOT:compile
[INFO] +- com.h2database:h2:jar:1.4.196:compile
[INFO] +- org.junit.jupiter:junit-jupiter-api:jar:5.1.0:test
[INFO] |  +- org.apiguardian:apiguardian-api:jar:1.0.0:test
[INFO] |  +- org.opentest4j:opentest4j:jar:1.0.0:test
[INFO] |  \- org.junit.platform:junit-platform-commons:jar:1.1.0:test
[INFO] \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO]                                                             
like image 40
Thorbjørn Ravn Andersen Avatar answered Jan 26 '23 14:01

Thorbjørn Ravn Andersen