Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Sometimes you want to exclude all or a group of dependencies of an artifact, because your build doesn't require the transitive dependencies or your build includes better alternatives. It would be nice to have 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
xml
xml
<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
xml
xml
<dependency>
  <groupId>org.mycompany.project1</groupId>
  <artifactId>project1</artifactId>
  <version>1.1</version>
  <exclusions>
    <exclusion>
      <groupId>*</groupId>
    </exclusion>
  </exclusions>
</dependency>

References

MNG-3832