Search code examples
javaspring-bootmavenintellij-ideadependencies

How to check that where in the Spring boot project (IntelliJ IDEA), particular maven dependency is used?


In the pom.xml file there are many dependencies are added. I want to check one particular dependency is used where in the whole project. I am using IntelliJ IDEA for Spring Boot project. Project is too big to check each file manually. I want to check where the below dependency is used in the project?

<dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>19.0</version>
</dependency>

Solution

  • Two ways :

    First :

    CTRL+shift+F and search for "com.google.guava". This will give you all the files where classes from this package has been imported.

    Second :

    Remove the dependency from pom.xml. And reload your pom changes.

    This will remove your library from classpath. As soon as this happens, your IDE will start showing red lines under all the classes where your dependency has been used as it'll not find classes from your library mentioned in imports.