[Backport 4.0.x] Fix operator precedence skipping type=bom dependency imports - #12930
Merged
Conversation
* Fix operator precedence skipping type=bom dependency imports importDependencyManagement treated BOM-typed import-scoped dependencies as non-imports because `|| "bom".equals(...)` made the continue branch always true for type=bom. Accept pom or bom with import scope, align validator messaging, and cover with a regression test. Fixes #12589 * type=bom does not require scope=import for dependency management import The bom type inherently implies import semantics (unlike type=pom which needs scope=import). Change the filter from (pom || bom) && import to (pom && import) || bom, and update the test to verify that type=bom alone is sufficient. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Revert validator change: bom type does not require scope=import The import-scope validator check fires only when scope=import is set. Adding bom there incorrectly implies that type=bom requires scope=import, but bom inherently implies import semantics and works without it. The original check (type must be 'pom' for scope=import) is correct. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Guillaume Nodet <gnodet@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
gnodet
commented
Aug 30, 2026
gnodet
left a comment
Contributor
Author
There was a problem hiding this comment.
Clean backport of #12722 to maven-4.0.x. The operator-precedence fix is correct — moving the closing parenthesis to group (pom && import) || bom inside the negation ensures type=bom entries are properly handled as import BOMs in Maven 4.
Observations (informational):
- The 92 additions are justified: test POM (with ASF license header), test method, DI provider methods for file transport, imports, and the 2-line fix itself
- The backport diff is identical to the merged #12722 on master (same 3 files, same changes)
- The two earlier backport attempts (#12909, #12914) were superseded — the design discussion on #12914 confirmed that
type=bomshould not requirescope=importsince bom inherently implies import semantics in Maven 4 - Maven 3.9.x and 3.10.x are not affected: those branches only check
type=pom && scope=importwith notype=bomhandling, since bom is a Maven 4 concept
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Backport of #12722 to
maven-4.0.x.importDependencyManagementskipped every dependency withtype=bombecause of operator precedence:For
type=bomthe|| bomterm is always true, so BOM-typed entries never loaded managed dependencies. This fix treats(pom && import) || bomas an import BOM/POM entry.Fixes #12589