Override dependencies of third party jar in maven

前端 未结 3 1477
灰色年华
灰色年华 2021-01-05 07:13

Like this org.carrot2 is depending on commons-httpclient 3.1 So how I can change this commons-httpclient 3.1 to HttpClient 4.1.1

3条回答
  •  生来不讨喜
    2021-01-05 08:16

    Add a dependency on HttpClient 4.1.1 to your POM. Maven will recognize the conflict (assuming groupId and artifactId of httpclient have not changed) between your direct dependency, and the indirect dependency, and use the newer version. (not because its the newer one, but because it is the more direct one)

    And it makes sense you can't edit other people's pom files - after all, you want carrot to use the newer http client only in your program, not in all programs that use carrot ...

提交回复
热议问题