Reputation: 13
first time asking. Sorry if I write weird but English is not my first language.
I have a maven dependency in my maven project for an external API. The thing is, that this dependency changes my common-io. From 2.8 to 2.2.
I would like to prevent this because affects one class of my project and I am not the only one working in it. Also, it could affect to future coding.
Is there a way to prevent this?
Upvotes: 1
Views: 1906
Reputation: 13
Thanks for the help, in the end I put directly de dependency in my pom but I didn't know that you could exclude from a dependency. Good to know.
Upvotes: 0
Reputation: 1012
If commons-io is already provide by your pom and is newer than the version brought by the dependent you could exclude commons-io from this dependency :
<project>
...
<dependencies>
<dependency>
<groupId>sample.ProjectA</groupId>
<artifactId>your dependency-A</artifactId>
<version>1.0</version>
<scope>compile</scope>
<exclusions>
<exclusion> <!-- declare the exclusion here -->
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</exclusion>
</exclusions>
</dependency>
More details here
Upvotes: 2