You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "charangowdamd-cmd (via GitHub)" <gi...@apache.org> on 2026/10/15 15:58:20 UTC
[PR] Fix #13479: Accept the ? optional-profile prefix in -P [maven]
charangowdamd-cmd opened a new pull request, #13549:
URL: https://github.com/apache/maven/pull/13549
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
- Extracted profile activation option handling into package-private performProfileActivation(CommandLine, List<String>, List<String>) in MavenCli.
- Stripped leading ? optional-profile marker after processing +, -, or ! prefixes.
- Skipped tokens that become empty after stripping prefixes.
- Added unit tests estOptionalProfiles and estDegenerateProfileTokens in MavenCliTest.
---
- [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.
- [x] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
- [x] Run mvn verify to make sure basic checks pass.
- [x] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Backport maven-3.10.x] Fix #13479: Accept the ? optional-profile prefix in -P [maven]
Posted by "charangowdamd-cmd (via GitHub)" <gi...@apache.org>.
charangowdamd-cmd closed pull request #13549: [Backport maven-3.10.x] Fix #13479: Accept the ? optional-profile prefix in -P
URL: https://github.com/apache/maven/pull/13549
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Fix #13479: Accept the ? optional-profile prefix in -P [maven]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #13549:
URL: https://github.com/apache/maven/pull/13549#issuecomment-6196435138
<!-- license-declaration-check -->
### ⚠️ License declaration missing
The pull request description must contain at least one of the following lines with a **checked** box (`[x]`):
```markdown
- [ ] 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).
```
This comment will be hidden automatically once the description is fixed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Backport maven-3.10.x] Fix #13479: Accept the ? optional-profile prefix in -P [maven]
Posted by "charangowdamd-cmd (via GitHub)" <gi...@apache.org>.
charangowdamd-cmd commented on PR #13549:
URL: https://github.com/apache/maven/pull/13549#issuecomment-6274833185
@slawekjaranowski
Thanks for pointing this out. After comparing both PRs, I can see that #13480 already covers the same fix for the `maven-3.10.x` branch. My intention was to contribute the fix for this issue, but I missed the existing PR. Sorry for the duplication. I'll close my PR to avoid duplicate work. Thank you for the clarification.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Backport maven-3.10.x] Fix #13479: Accept the ? optional-profile prefix in -P [maven]
Posted by "slawekjaranowski (via GitHub)" <gi...@apache.org>.
slawekjaranowski commented on PR #13549:
URL: https://github.com/apache/maven/pull/13549#issuecomment-6271446606
@charangowdamd-cmd what is different in your PR then we have in:
- https://github.com/apache/maven/pull/13480
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org