Vytsalo
Vytsalo

Reputation: 748

How to find out about unused dependencies Maven in Intellij Idea

My project is growing but i have many unused dependencies, how to find out, which one i really need, and which one is really useless? There is a some Intellij Idea Extensions?

Upvotes: 15

Views: 20813

Answers (2)

Tnadev
Tnadev

Reputation: 10082

Add this plugin to your pom.xml:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>3.5.0</version>
</plugin>

Then just run mvn dependency:analyze-report.

Upvotes: 3

J Fabian Meier
J Fabian Meier

Reputation: 35805

You can run the Maven goal dependency:analyze which lists the dependencies that are not used in your source code. Beware, though, that sometimes dependencies are necessary although they are not referenced in source code.

Upvotes: 17

Related Questions