0

Is there a way to generate somehow a Histogram of Maven Dependencies? (number of usages over the library)

I would like to know for all of our projects (not necessary connected in any terms):

  • What libraries/dependencies are used
  • In what version they are used
  • Form how many modules/projects they are used

Is there a way to extract this information with maven (or any other tool) form the POMs?
Do you have suggestions how to collect this info over many projects?

PaulEdison
  • 897
  • 1
  • 15
  • 36

2 Answers2

1

You can do that with a command:

mvn dependency:tree -Dverbose

The -Dverbose option will show all dependencies, even the ones removed.

Read here for more info

Leviand
  • 2,745
  • 4
  • 29
  • 43
  • That could go into the right direction. But What is `-Dincludes=commons-collections` for as I did not found it in the usage/goals/faq there. Further more the tree is nice but would still cause a lot of work to do to sum it up (flatten, merge, sum, ... for all projects) and the other output modes (to spare out the flatten) seems to work on Module/pom level only. – PaulEdison Jul 27 '18 at 09:36
  • Yeah you'r right, I've removed that from answer. About the work to do, yeah, unfortunaly there's no other way: maven is powerful, but finding problem like these requires alot of digging. Had same problem few time ago and spent like 2 days for finding the problem... (ps: upvote the answer if was useful pls! :) ) – Leviand Jul 27 '18 at 09:42
0

IntelliJ Idea

In IntelliJ Idea, open pom.xml file, right-click anywhere and select Diagrams -> Show dependencies...:

IntelliJ Idea

Nikolas Charalambidis
  • 40,893
  • 16
  • 117
  • 183
  • I'm using IntelliJ Idea 2018.1 but I don't see this option. But if it is working like the module/class diagram that does not help much, as I would have to do it manually on all modules to get the diagram (nice picture) but would have to manually check it for all of them and add them up. – PaulEdison Jul 27 '18 at 09:22
  • I have IntelliJ IDEA Ultimate 2018.1.5 – Nikolas Charalambidis Jul 27 '18 at 09:23