sometimes Sometimes you want to exclude all or a group of dependencies of an artifact, because you have your build doesn't require the transitive dependencies or your build includes better alternatives. It would be nice to have an a wildcard type of exclusion on groupId and artifactId. One example is when depending on an artifact with a classifier, the build does not always require the same transitive dependencies that the main artifact uses.
Exclude all transitive dependencies
| Code Block |
|---|
|
<dependency>
<groupId>org.mycompany.project1</groupId>
<artifactId>project1</artifactId>
<version>1.1</version>
<exclusions>
<exclusion>
<groupId>org.apache.commons</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
|
Exclude transitive dependencies with the groupId "org.company"
| Code Block |
|---|
|
<dependency>
<groupId>org.mycompany.project1</groupId>
<artifactId>project1</artifactId>
<version>1.1</version>
<exclusions>
<exclusion>
<groupId>*</groupId>
</exclusion>
</exclusions>
</dependency>
|