Is it possible to optimize maven dependencies automatically?
- by AlexR
I am working on a big project that consists of about 40 sub-projects with very not optimized dependencies. There are declared dependencies that are not in use as well as used but undeclared dependencies. The second case is possible when dependency is added via other dependency.
I want to remove redundant and add required dependencies. I ran mvn dependency:analyze and got a long list of warnings I have to fix now.
I wonder whether there is maven plugin or any other utility that can update my pom.xml files automatically. I tried to do it manually but it takes a lot of time. It seems it will take a couple of days of copy/paste to complete the task.
In worse case I can write such script myself but probably ready stuff exists?
Here is how mvn dependency:analyze reports dependency warnings:
[WARNING] Used undeclared dependencies found:
[WARNING] org.apache.httpcomponents:httpcore:jar:4.1:compile
[WARNING] Unused declared dependencies found:
[WARNING] commons-lang:commons-lang:jar:2.4:compile
[WARNING] org.json:json:jar:20090211:compile