Effect of "overriding" exclusions in maven dependency

dependency-management, maven, maven-dependency-plugin

Solution

Yes, Maven's exclusions are additive. You'll have both exclusions. There is no way to cancel some inherited exclusion other than just re-add it as a new local dependency.

And by the way, it is about 1-2 minutes to verify this at your own computer...

Problem

How are exclusions in the parent pom affected by exclusions in the child pom? Are the exclusions additive? Here's an example: ``` .... <dependencyManagement> <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <version>${hibernate.version}</version> <exclusions> <exclusion> <groupId>commons-collections</groupId> <artifactId>commons-collections</artifactId> </exclusion> </exclusions> </dependency> </dependencyManagement .... ``` In Child pom - ``` ..... <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-entitymanager</artifactId> <exclusions> <exclusion> <groupId>cglib</groupId> <artifactId>cglib</artifactId> </exclusion> </exclusions> </dependency> .... ``` Ultimately, are both `commons-collections` and `cglib` excluded? If so, is there any way I can "bring back" `commons-collections` for the child project?

Original source