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 #13883: Do not shadow a custom rootDirectory property by slawekjaranowski · Pull Request #13885 · apache/maven

Conversation

@slawekjaranowski

@slawekjaranowski slawekjaranowski commented Nov 7, 2026

Copy link
Copy Markdown
Member

Fixes #13883

Maven 3.10.0 accepted an unprefixed ${rootDirectory} as an alias for ${project.rootDirectory}.
Since this value source is evaluated before the model properties, it shadowed a custom
rootDirectory property defined in the POM, e.g.:

<properties>
  <rootDirectory>${project.basedir}</rootDirectory>
</properties>

In a multi-module build, ${rootDirectory} then resolved to the project root directory instead of
the module basedir (as it did in Maven 3.9.x), breaking builds such as assertj/assertj-generator#339.

Change

AbstractStringBasedModelInterpolator: the rootDirectory value source now accepts only the prefixed
${project.rootDirectory} (and ${pom.rootDirectory}), as ${project.baseUri} does.
The unprefixed form was never documented, and file-based profile activation already supports
the prefixed form only.

Maven 4 is not affected; regression tests for it were added in #13884.

Tests

  • AbstractModelInterpolatorTest (run by StringSearchModelInterpolatorTest and StringVisitorModelInterpolatorTest):
    • testRootDirectory: ${project.rootDirectory} resolves to the root directory from a module
    • testCustomRootDirectoryPropertyIsNotShadowed: a custom ${rootDirectory} property resolves
      to its own value (fails without the fix)
    • testUnprefixedRootDirectoryIsNotInterpolated: ${rootDirectory} is not an alias
      (fails without the fix)
  • FileProfileActivatorTest: the same two cases for file-based profile activation
    (already working, guarded against regressions)

Documentation

maven-model-builder/src/site/markdown/index.md: file-based profile activation supports
${project.rootDirectory} since Maven 3.10.0.

🤖 Generated with Claude Code

Sorry, something went wrong.

Uh oh!

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

All reactions
@slawekjaranowski @claude
Fix apache#13883: Do not shadow a custom rootDirectory property
30d58cb
Maven 3.10.0 accepted an unprefixed ${rootDirectory} as an alias for
${project.rootDirectory}. As this value source is evaluated before the model
properties, it shadowed a custom rootDirectory property defined in the POM,
e.g. <rootDirectory>${project.basedir}</rootDirectory>, which then resolved
to the project root directory instead of the module basedir.

Only accept the prefixed ${project.rootDirectory} (and ${pom.rootDirectory}),
as for ${project.baseUri}. The unprefixed form was never documented, and
profile activation already supports the prefixed form only.

Add tests for model interpolation and file-based profile activation, and
document ${project.rootDirectory} for profile activation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
cstamas
cstamas approved these changes Nov 7, 2026
View reviewed changes
@slawekjaranowski slawekjaranowski self-assigned this Nov 7, 2026
@slawekjaranowski slawekjaranowski added the bug Something isn't working label Nov 7, 2026
@slawekjaranowski slawekjaranowski linked an issue Nov 7, 2026 that may be closed by this pull request
Maven 3.10.0 shadows custom rootDirectory property #13883
Closed
gnodet-bot
gnodet-bot approved these changes Nov 7, 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.

LGTM. Minimal, correct fix — allowUnprefixedExpressions: false on the rootDirectory value source correctly stops ${rootDirectory} from shadowing user-defined POM properties. The documentation update and regression tests are consistent and thorough.

Pre-fix validation: testCustomRootDirectoryPropertyIsNotShadowed and testUnprefixedRootDirectoryIsNotInterpolated confirmed failing before the fix on both StringSearchModelInterpolatorTest and StringVisitorModelInterpolatorTest, passing after. ✅

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
@slawekjaranowski
slawekjaranowski merged commit b40b50e into apache:maven-3.10.x Nov 7, 2026
15 checks passed

Uh oh!

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

@github-actions github-actions Bot added this to the 3.10.1 milestone Nov 7, 2026
@slawekjaranowski
slawekjaranowski deleted the issue-13883-root-directory-3.10.x branch November 7, 2026 20:47
@goutamadwant goutamadwant mentioned this pull request Nov 8, 2026
Fix recursion detection for custom rootDirectory aliases #13891
Merged
6 of 8 tasks
@scordio scordio mentioned this pull request Nov 8, 2026
Bump org.apache.maven:apache-maven from 3.9.16 to 3.10.0 assertj/assertj-generator#339
Closed
cstamas pushed a commit that referenced this pull request Nov 9, 2026
@goutamadwant
Fix recursion detection for custom rootDirectory aliases (#13891)
847220e
Follow-up to #13885, related to #13883. Targets `maven-3.10.x`.

The original shadowing fix is already merged. A custom `rootDirectory` that refers to `${project.rootDirectory}` or `${pom.rootDirectory}` can still fail interpolation because the recursion detector treats the custom property and the built-in expression as the same key.

Track bare `rootDirectory` separately and retain prefix-aware cycle detection for the other expressions. Tests cover model, user and system aliases, early model consumers, genuine cycles and tracker reset in both interpolators.

### Validation

- New regressions fail on unchanged current `maven-3.10.x`.
- `mvn -B -ntp verify`: 1,154 tests reported, 8 skipped, zero failures or errors.
- Four focused Core IT cases pass with the fix; the explicit-root alias case fails on the current upstream distribution. [Companion integration tests](https://github.com/goutamadwant/maven/tree/29cb5e6764418ce6f46734e5cbb7ac57e6191b72/its/core-it-suite/src/test/resources/gh-13883-custom-root-directory).
- Full Core IT suite and hosted CI have not been run.

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

- [x] Your pull request should address just one issue, without pulling in other changes.
- [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [x] 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.
- [x] 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.
- [x] 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][core-its] successfully.

If your pull request is about ~20 lines of code you don't need to sign an
[Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) 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](http://www.apache.org/licenses/LICENSE-2.0)
you have to acknowledge this by using the following check-box.

- [x] I hereby declare this contribution to be licensed under the [Apache License Version 2.0, January 2004](https://www.apache.org/licenses/LICENSE-2.0)
- [ ] I hereby declare that I have filed an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@cstamas cstamas cstamas approved these changes
+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

@slawekjaranowski slawekjaranowski

Labels

bug Something isn't working

Projects

None yet

Milestone

3.10.1

Development

Successfully merging this pull request may close these issues.

Maven 3.10.0 shadows custom rootDirectory property

Uh oh!

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

3 participants

@slawekjaranowski @cstamas @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.