How do I detect which dependencies and which libraries in the project are used or which are not?

620 Views Asked by At

Some 3rd party libraries and dependencies are obsolete or outdated in my Maven project. How do I detect which ones are used and which are not? How do I update outdated ones?

I want the unused ones to be deleted and the outdated ones to be updated.

2

There are 2 best solutions below

0
romanv-jb On
0
Slawomir Jaranowski On

For detecting not used dependencies in project you can consider output of:

mvn dependency:analyze

dependency:analyze detects unused dependencies by scanning bytecode of your application, so can happen that some of dependencies used only in runtime will be wrong detected.

But more of detected unused dependencies of should be ok.


For detecting outdated dependencies you can use:

mvn versions:display-dependency-updates