I have the following dependency tree:
Project A
----Project B
-----Project D
--------Project G
----Project C
-----Project E
--------Project H
-----Project F
The jar of Project G is no longer available and no attempt should be made to download it during build.
The only accessible pom is that of Project A, which contains a dependency of Project B.
So we have added the following in the pom:
<dependency>
<groupId>xxxxx</groupId>
<artifactId>Project B</artifactId>
<version>xxxx</version>
<scope>compile</scope>
<exclusions>
<exclusion>
<artifactId>Project G</artifactId>
<groupId>xxxxxx</groupId>
</exclusion>
</exclusions>
</dependency>
Would adding an exclusion at the higher level of dependency work?
How do we avoid Project G from being downloaded during build?
Yes. Exclusions work at any level. Usually, I would use an exclude for project D instead of B because project D is the direct cause for the dependency.
Note, however, that any other path could still bring in G as dependency because there are no global exclude statements.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.