[MNG-8578]add exclusion scope to repo, allow exclude dependencies from build(including parent, dependencies, etc)#2106
Conversation
…m build(including parent, dependencies, etc)
0e34230 to
1e01c86
Compare
|
must use with changes in resolver |
elharo
left a comment
There was a problem hiding this comment.
same comments as in maven-resolver
|
Resolve #9869 |
gnodet
left a comment
There was a problem hiding this comment.
AI Code Review — PR #2106
Verdict:
This PR adds top-level <exclusions> to both ModelBase and Parent in the POM schema, plus wiring in DefaultProjectDependenciesResolver to apply them during dependency collection. It also includes unrelated @Nullable/@Nonnull annotation changes in RepositoryUtils.java.
Critical blocker: The companion maven-resolver PR (apache/maven-resolver#654) was closed as wontfix. The resolver API (CollectRequest.addExclusion()) this PR depends on does not exist and will not be released.
Findings
| # | Severity | File | Details |
|---|---|---|---|
| 1 | 🔴 High | pom.xml |
Unreleased dependency — resolverVersion is set to 2.0.7.exclusion, which is not a published artifact. Latest releases are 2.0.x. The companion PR was closed as wontfix, so this version will never be released. The PR cannot build. |
| 2 | 🔴 High | maven.mdo |
Major POM schema change without design proposal — Adds <exclusions> to ModelBase (inherited by both Model and Profile) and Parent. This means profiles would gain exclusion support, and child POMs could exclude transitive dependencies from the parent's graph — novel semantics that need design discussion on the dev list. |
| 3 | 🔴 High | DefaultProjectDependenciesResolver.java:151-156 |
Won't compile — Calls collect.addExclusion() on CollectRequest, but this method does not exist in any released (or current master) version of maven-resolver. |
| 4 | 🟡 Medium | maven.mdo |
Misleading field descriptions — Both exclusion fields say "excluded from this repo's dependency list" but neither is on a repository class. ModelBase is the project/profile base, Parent is the parent POM reference. Descriptions should say "this project's" or "this parent's". |
| 5 | 🟢 Low | RepositoryUtils.java |
Unrelated changes bundled — ~25 methods get @Nullable/@Nonnull annotations, inflating the diff. Only the toExclusion() visibility change (private → public) is relevant to the feature. The annotation work should be a separate PR. |
Observations
- Stale PR — Open 17 months with no response to reviewer feedback. The requested changes (tests, documentation, design proposal) have not been addressed.
- No tests — Zero test coverage for the new exclusion feature.
- No design proposal — A POM schema change of this magnitude needs community discussion. The scope also doesn't match: title says "exclusion scope to repo" but implementation adds exclusions to
ModelBaseandParent, not repositories. - Recommendation — This PR cannot proceed in its current form. The resolver team rejected the companion change, making the entire approach non-viable. If the feature is still desired, it would need a new design proposal discussed on dev@maven, a new resolver PR accepted first, and a clean implementation with tests.
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
Claude Code on behalf of Guillaume Nodet
Reviewed 3 PRs: apache#11146 (APPROVE), apache#10952 (COMMENT), apache#2106 (COMMENT). 24 total reviews posted. ~35 PRs remaining. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Following this checklist to help us incorporate your
contribution quickly and easily:
for the change (usually before you start working on it). Trivial changes like typos do not
require a JIRA issue. Your pull request should address just this issue, without
pulling in other changes.
[MNG-XXX] SUMMARY,where you replace
MNG-XXXandSUMMARYwith the appropriate JIRA issue.[MNG-XXX] SUMMARY.Best practice is to use the JIRA issue title in both the pull request title and in the first line of the commit message.
mvn clean verifyto make sure basic checks pass. A more thorough check willbe performed on your pull request automatically.
If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.
I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004
In any other case, please file an Apache Individual Contributor License Agreement.