I was asked to optimize the dependencies of a big maven project, i.e. find and remove any and all dependencies that are now being used by the project. Therefore I chose the plugin maven-dependency-analysis:
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-dependency-analyzer</artifactId>
<version>1.11.1</version>
</dependency>
</dependencies>
</plugin>
to output a report of maven dependencies that are not being used, by executing the command mvn dependency:analyze -DignoreNonCompile=true
. I found that most dependencies reported under the "Unused declared dependencies found" section could be removed without any sort of problem, however there were a few dependences whose removal caused compilation errors. I was wondering why such dependencies are included in the "Unused declared dependencies found" section and if there is something that I'm missing?
Thank you for your attention.