Document `bannedDependencies` behavior change in 3.7.0 and provide an opt-out for optional dependencies

Open
#1,077 1 comment 1 reaction 1 assignee View on GitHub

Maintainers usually reply within 1 day

@slawekjaranowski is already working on this.

Since Nov 7, 2026.

  • #1078 by @slawekjaranowski — open

Assessment

This issue has not been assessed yet.

Description

bug
Affected version

3.7.0

Bug description

In 3.7.0, bannedDependencies started checking direct optional dependencies and their transitive dependencies. According to https://github.com/apache/maven-enforcer/pull/1025#issuecomment-5671222005, this change was intentional to restore behavior lost in 3.3.0, but it can break builds that passed with versions 3.3.x–3.6.x, like in https://github.com/scordio/junit-converters/pull/134.

The release notes mention only requireReleaseDeps, so the impact on bannedDependencies isn't clear. For example, an exclusion of *:*:*:jar:compile now also bans optional compile dependencies and their trees.

Could you please document this behavior change in the release notes or migration guidance?

Also, it appears there's no way to restore the previous behavior through the rule’s configuration, since <include> patterns cannot match optional dependencies. Would you consider introducing a bannedDependencies opt-out for checking optional dependency trees?

Dominant language
Java
Stars
162
Forks
190
Avg merge
1d 17h
Merged PRs (30d)
20

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/maven-enforcer

All issues in apache/maven-enforcer

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.