1

I am working on a Java Maven Project in IntelliJ IDEA but the POM file has so many dependencies from the other programmers that I have a feeling the project is not using most of the dependencies. How can I find out which dependencies are not being used in the project. thanks

Sotirios Delimanolis
  • 274,122
  • 60
  • 696
  • 724
SJS
  • 5,607
  • 19
  • 78
  • 105
  • Take a look and possible duplicate: http://stackoverflow.com/questions/1517611/is-there-a-simple-way-to-remove-unused-dependencies-from-a-maven-pom-xml – Sotirios Delimanolis Apr 10 '13 at 17:29
  • 2
    `mvn dependency:analyze` will give you some info – The Cat Apr 10 '13 at 17:42
  • If you're using IntelliJ, see this : http://jonnyzzz.com/blog/2013/05/13/removing-unused-dependencies-in-idea/ In case of dead link : Jonnyzzz Dependencies plugin – Benj Jun 14 '16 at 12:13

3 Answers3

3

Sometimes the simple solutions are the best.

One simple solution is to just remove all dependencies and try to compile your code. Fix all compilation errors by re-adding dependencies.

Andreas Wederbrand
  • 38,065
  • 11
  • 68
  • 78
0

Have you tried to run the IDEA code inspections? I think it checks maven too.

0

Try maven dependency plugin. Execute maven goal: dependency:analyze