Question

I am using Apache Maven to building the project..

Problem is some jars are added two times with the different versions.

httpclient-4.0.3 httpclient-4.3.3

httpcore-4.0.1 httpcore-4.3.2

jackson-core-asl-1.6.7 jackson-core-asl-1.9.13

i want the higher version of jars

Was it helpful?

Solution

Usually what you would do is look first at the dependency tree and see where the same jars are coming from:

mvn dependency:tree

After you tracked down where the different dependencies come from you, as in your case, you pick the ones that are older and you go ahead and add a <exclusion/> tag inside the dependency that retrieves the older ones. Example of how to exclude a dependency inside another dependency: Let us presume you have hibernate and ehcache dependencies in your pom.xml. If hibernate 3.2.6.ga, for example, has inside ehcache, but it is an older version and we don't want that version. So in order to exclude ehcache from hibernate dependency we would do the following

<dependency>
     <groupId>org.hibernate</groupId>
     <artifactId>hibernate</artifactId>
     <version>3.2.6.ga</version>
     <exclusions>
         <exclusion>
             <groupId>net.sf.ehcache</groupId>
             <artifactId>ehcache</artifactId>
         </exclusion>
     </exclusions>
</dependency>

Now, I would help you and add the correct exclusions to the dependencies that are retrieving your older dependencies, but since I am not able to see your pom.xml it is hard to help more.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top