I have two projects A, and B.
Project A depends on Project B. Project B depends on a library C which depends on a library D. I own both A and B but they live in separate code bases and are independent. Project B is like an internal common helper library.
- A -- B --- C (version 1.1) ---- D (version 1.1)
I want to upgrade D to a newer minor version, let's say 1.5.
So in B's pom.xml file, I imported D (v1.5) directly. Then excluded D from C. Example:
<dependency> <groupId>D</groupId> <artifactId>foobar</artifactId> <version>1.5</version> </dependency> <dependency> <groupId>C</groupId> <artifactId>fizzbuzz</artifactId> <version>1.1</version> <exclusions> <exclusion> <groupId>D</groupId> <artifactId>foobar</artifactId> </exclusion> </exclusions> </dependency>
Next if I run
[~/projectB] $ mvn dependency:tree
I confirm that only 1.5 is used, not 1.1. Next I build a new local snapshot of B. And specify Project A to use that one.
My problem is when I build Project A, it continues to use v1.1 and ignores the exclusion in B. This always returns 1.1 instead of the 1.5 that I want.
[~/projectA] $ mvn dependency:tree
Project A never imports C or D directly, it only get library D from importing Project B.
I've tried:
- Reloading the maven imports
- Running mvn clean install numerous times.
- Deleting the folders from my .m2/ directory to force reimports
I'm out of troubleshooting ideas. Does anyone else have any tips?
https://stackoverflow.com/questions/65855039/maven-project-a-not-respecting-project-bs-exclusion January 23, 2021 at 10:07AM
没有评论:
发表评论