Home > Enterprise >  How to find out which Maven dependency bring another dependency (artifact) in Intellij
How to find out which Maven dependency bring another dependency (artifact) in Intellij

Time:11-27

Basically I need to update gson to latest version (2.8.9), but as it is not included in POM directly, how can I find out which dependency brings it? In Intellij, in Maven "Dependencies tree" I'm able to manually open them one by one, but is there any automatic way how to do it?

CodePudding user response:

Based on my understanding, you're opening dependencies in maven tab one by one. In terminal tab, run mvn dependency:tree and you'll be able to see entire tree with version details.

CodePudding user response:

  1. Use mvn dependency:tree -Dincludes=com.google.code.gson:gson to check for dependencies which bring gson into your project.

  2. Use <dependencyManagement> section of the POM to control the versions of artifacts used in transitive dependencies. Just add the following snippet:

    <dependencyManagement>
      <dependencies>
        <dependency>
          <groupId>com.google.code.gson</groupId>
          <artifactId>gson</artifactId>
          <version>2.8.9</version>
        </dependency>
      </dependencies>
    </dependencyManagement>
    
  • Related