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
. I am working in eclipse. As I want to remove
commons-httpclient:3.1
from those who are depending on this jar file and I want to replace with HttpClient 4.1.1
.
So what I was trying to do.. I doubled click on this org.carrot2
from dependency hierarchy folder and went into its pom.xml file and was trying to change commons-httpclient 3.1
to httpclient 4.1.1 but it is not allowing me to change as backspace and delete is not working on that..
Any suggestions will be appreciated..
By taking advantage of Maven's nearest definition logic, developers can override the version of a dependency by declaring it on the root pom. xml file.
Multiple transitive dependencies can be excluded by using the <exclusion> tag for each of the dependency you want to exclude and placing all these exclusion tags inside the <exclusions> tag in pom. xml. You will need to mention the group id and artifact id of the dependency you wish to exclude in the exclusion tag.
Firstly please ensure that the mentioned artifact can work properly with the HttpClient 4.1.1.
We can define "the exclusion" for each dependency as it is mentioned at http://maven.apache.org/pom.html#Exclusions
Exclusions explicitly tell Maven that you don't want to include the specified project that is a dependency of this dependency (in other words, its transitive dependency)
exclusions: Exclusions contain one or more exclusion elements, each containing a groupId and artifactId denoting a dependency to exclude. Unlike optional, which may or may not be installed and used, exclusions actively remove themselves from the dependency tree.
<dependencies>
<dependency>
<groupId>the_group</groupId>
<artifactId>the_artifact</artifactId>
<version>the_version</version>
<exclusions>
<exclusion>
<groupId>the_apache_group</groupId>
<artifactId>the_http_client_artifact</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>the_apache_group</groupId>
<artifactId>the_http_client_artifact</artifactId>
<version>4.1.1</version>
</dependency>
...
</dependencies>
I hope this may help to achieve the requirement.
Regards,
Charlee Ch.
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 ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With