You cannot change POM of a 3rd party dependency. But you can exclude its dependencies.
<dependency>
<groupId>.....</groupId>
<artifactId>.....</artifactId>
<version>.....</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<groupId>org.mortbay.jetty</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
Important:
- Use
<exclusions>
in the correct<dependency>
. Otherwise it will have no effect. <exclusions>
works for the whole sub-tree of<dependency>
, including all its nested dependencies. Just find the top level<dependency>
in your POM that brings undesired jar and use<exclusions>
there.- The same undesired jar may come via multiple dependencies. After you excluded it in one place, refresh the dependency tree, and check if undesired jar comes via some other dependency. If yes, then exclude it also on other places.