Repository navigation
[Backport maven-3.10.x] Fix #13479: Accept the ? optional-profile prefix in -P - #13549
charangowdamd-cmd wants to merge 1 commit into
Conversation
Maven 4 reads -P ?id as an optional profile (MNG-7051); Maven 3 read it as a profile named ?id and left id off. The prefix is now removed after the +, - and ! prefixes, in the same order as Maven 4. Empty tokens left after stripping prefixes are skipped.
This comment has been minimized.
This comment has been minimized.
gnodet-bot
left a comment
There was a problem hiding this comment.
Clean, correct backport of Maven 4's optional-profile ? prefix handling to 3.10.x. The prefix-stripping order (sign prefix → ? → empty check) matches Maven 4's performProfileActivation, and the tests correctly validate the new behavior — testOptionalProfiles() would fail without the fix since the old code would leave ?run-its with the ? prefix in the active list. Edge cases (bare ?, !?, +?, consecutive commas) are covered by testDegenerateProfileTokens().
This review was generated by an AI agent, Hermès on behalf of @gnodet.
|
@charangowdamd-cmd what is different in your PR then we have in: |
|
@slawekjaranowski |
Fixes #13479.
Description
Maven 4 treats -P ?id as an optional profile (MNG-7051): activate it if it exists, skip it otherwise. In Maven 3.x, -P ?id was read literally as a profile named ?id, which caused a warning that ?id does not exist and left the real profile unactivated. This causes builds that pass -P ?profile (such as CI matrices testing Maven 3 and 4 side by side) to silently skip profiles on Maven 3.
This PR adds support for accepting ? after +, -, and ! prefixes in -P, aligning with Maven 4's prefix evaluation order, and skipping any degenerate tokens that are left empty after stripping prefixes.
Changes
Following this checklist to help us incorporate your contribution quickly and easily:
Note that commits might be squashed by a maintainer on merge.
This may not always be possible but is a best-practice.
A more thorough check will be 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.