GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix reactor BOM imports in also-make graph by mcc0nnell · Pull Request #13040 · apache/maven

Conversation

@mcc0nnell

@mcc0nnell mcc0nnell commented Sep 4, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Fixes #11397.

ProjectSorter builds the reactor dependency graph used by -am, but imported BOMs declared under were not represented as reactor edges.

As a result, when one reactor module imports another reactor module as a BOM, for example:

org.example example-bom ${project.version} pom import

running:

mvn -am -pl example-consumer ...

could omit example-bom from the selected reactor even though the consumer depends on it for its effective model. This can cause Maven to use a stale locally installed BOM or fail when the BOM is not already available.

Change

Treat imported BOMs from the project’s original model as reactor graph edges.

The original model is used because BOM import declarations are no longer available in the same form after dependency-management model processing.

Before matching the imported BOM against reactor coordinates, the change resolves:

  • ${project.version}
  • ${pom.version}
  • exact ${property} references available from the project properties

Literal versions continue to be matched directly.

This keeps the behavior in ProjectSorter, so -am and other consumers of the reactor graph see the same dependency relationship rather than adding special handling only to project selection.

Tests

Adds a focused regression test where:

  • the consumer is intentionally supplied to ProjectSorter before the BOM;
  • the consumer imports the BOM from ;
  • the BOM version is ${project.version};
  • the resulting graph must contain the BOM as an upstream dependency;
  • the BOM must sort before the consumer.

Without the reactor edge, the test fails because the imported BOM is absent from the consumer’s graph dependencies and the original input order is retained.

Verification

Full local mvn verify and the Core IT suite have not been run in this environment because the available shell cannot access external dependencies. Repository CI can perform the full verification.

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Your pull request should address just one issue, without pulling in other changes.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body.
    Note that commits might be squashed by a maintainer on merge.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
    This may not always be possible but is a best-practice.
  • Run mvn verify to make sure basic checks pass.
    A more thorough check will be performed on your pull request automatically.
  • You have run the Core IT successfully.

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.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
gnodet
gnodet reviewed Sep 4, 2026
View reviewed changes

@gnodet gnodet left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix for a real gap in the reactor dependency graph. The approach of using getOriginalModel() is correct — BOM import declarations are consumed during model processing, so the effective model doesn't retain them in their original form. The version resolution logic handles the common patterns (${project.version}, ${pom.version}, single property reference) and degrades safely for unresolvable expressions (no edge added, which is correct).

The test is focused and properly asserts both the dependency edge and the sort order.

One nit below.

Backport: The issue (#11397) is labeled mvn3 and was reported against 3.9.11. This PR targets master (4.x). Will this need a backport to maven-3.10.x / maven-3.9.x? The code path exists in both branches — ProjectSorter is shared.

Metadata:

  • Category: bug fix
  • Suggested labels: bug
  • Milestone: suggest 4.1.0

This review was generated by an AI agent, Hermès on behalf of @gnodet.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread impl/maven-core/src/main/java/org/apache/maven/project/ProjectSorter.java Outdated
.collect(Collectors.collectingAndThen(Collectors.toList(), Collections::unmodifiableList));
}

private String resolveImportVersion(MavenProject project, String version) {

@gnodet gnodet Sep 4, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Nit: This method doesn't access any instance state — only its parameters. It could be static.

Suggested change
private String resolveImportVersion(MavenProject project, String version) {
private static String resolveImportVersion(MavenProject project, String version) {

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@mcc0nnell
Fix reactor BOM imports in also-make graph
4b56c5f
Treat dependency-management BOM imports from the original project model as reactor graph edges so -am includes imported BOM modules. Resolve the common project-version and exact property-reference forms before matching reactor coordinates.

Signed-off-by: Robert McConnell <[email protected]>
@mcc0nnell
mcc0nnell force-pushed the fix-reactor-bom-also-make branch from 240759e to 4b56c5f Compare September 9, 2026 02:23
@mcc0nnell
Make reactor BOM version resolver static
1f5e62b
Apply the review suggestion: resolveImportVersion only uses its parameters and does not require ProjectSorter instance state.

Signed-off-by: Robert McConnell <[email protected]>
gnodet-bot
gnodet-bot approved these changes Sep 14, 2026
View reviewed changes

@gnodet-bot gnodet-bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previous nit addressed — resolveImportVersion is now static. No other changes. Code logic was already reviewed and found sound.

This review was generated by an AI agent, Hermès on behalf of @gnodet.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@gnodet
gnodet merged commit d296cc3 into apache:master Sep 24, 2026
19 of 20 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot added this to the 4.1.0 milestone Sep 24, 2026
@github-actions github-actions Bot assigned gnodet Sep 24, 2026
@github-actions

github-actions Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

@gnodet Please assign appropriate label to PR according to the type of change.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Sep 24, 2026
Backport #13040: treat reactor BOM imports as ProjectSorter edges so -am includes them #13262
Merged
Backport #13040: treat reactor BOM imports as ProjectSorter edges so -am includes them #13263
Merged
Improve reactor BOM import warning: add coordinates and explain actual risk #13264
Merged
[MNG-8009] BOM peculiarities with build ordering #10857
Open
[MNG-8191] [reactor build order] modules used in dependencyManagement-section with scope import should be ordered first #10755
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gnodet gnodet gnodet left review comments
+1 more reviewer
@gnodet-bot gnodet-bot gnodet-bot approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@gnodet gnodet

Labels

None yet

Projects

None yet

Milestone

4.2.0

Development

Successfully merging this pull request may close these issues.

mvn -am -pl unexpectedly skips bom import dependencies

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@mcc0nnell @gnodet @gnodet-bot
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.