Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven Dependency Conflict

A maven project consisting of some modules. One of my module is using guava dependency of google version 11.0.2. Now i am integrating another module in my project which is also using guava but version 14.

So i want that new module uses guava version 14 but remaining project use guava version 11.0.2. I have tried adding <exclusion></exclusion> of guava to the new module but it didn't work.

Any tips to solve this.

Update: @Guillaume Darmont's Answer solves the problem for different modules. but now my problem is, the new modules has 2 dependency one of the them is using guava 11.0.2 and other is using 14.0. how to manage this. can we specify separately in the pom of the module that which version of the guava it should use.?

like image 761
Amol Sharma Avatar asked Jun 27 '13 05:06

Amol Sharma


2 Answers

As I understand your question, you may add a <dependencyManagement> for guava in your new module pom.xml :

<dependencyManagement>
  <dependencies>
      <dependency>
          <groupId>com.google.guava</groupId>
          <artifactId>guava</artifactId>
          <version>14.0.1</version>
      </dependency>
  </dependencies>
</dependencyManagement>
like image 186
Guillaume Darmont Avatar answered Sep 20 '22 12:09

Guillaume Darmont


mvn dependency:tree command will help to determine which module is bringing the Guava 14 jar file.

like image 39
user1573133 Avatar answered Sep 19 '22 12:09

user1573133