I'm not sure if this is support by Maven or not. I appreciate any help I can get.
I have a parent pom that defines a dependency and an exclusion. I can't change the parent pom:
foo
bar
1.0
org.springframework.cloud
spring-cloud-config-server
Then in the child pom, I have a need to exclude a different dependency from that same dependency in the parent. Like so
foo
bar
1.0
org.slf4j
slf4j-log4j12
But if I do that, the child will have the slf4j jar excluded (correctly), but it will NOT have the spring-cloud-config-server jar excluded, unless if I restate the parent exclusion in the child declaration of that dependency.
I realize I could just copy it, but that's messy, and I realize that it would be easy to push the child's exclusion up to the parent, but then I'd be forcing that exclusion on all the other children.
What I'd like is for Maven to merge the dependency exclusion information when the same dependency is declared differently in the parent and child.
Is that possible?
解决方案
In your parent pom:
foo
bar
1.0
org.springframework.cloud
spring-cloud-config-server
In your child pom:
foo
bar
org.slf4j
slf4j-log4j12