gnodet commented on PR #13480: URL: https://github.com/apache/maven/pull/13480#issuecomment-6163609557
> > @slachiewicz why is the difference with the trim kept on purpose ? > > The 3.x line has always trimmed each token before reading its +, - or ! prefix; the old code removed by the PR does nextToken().trim(). Maven 4 trims too, and its -/! check reads the trimmed id. Only its + check reads the raw token (token.charAt(0) == '+'), and that looks like a slip rather than a design choice. With -P "a, +b", Maven 4 tries to activate a profile literally named +b. Master has the same check twice in MavenInvoker.java (lines 405 and 432), presumably once for profiles and once for projects. Matching Maven 4 would mean copying that slip into 3.10. > > > The trim isn’t new: 3.x has always trimmed each token before reading its prefix (the removed nextToken().trim()), and Maven 4 trims too. The difference is only in Maven 4’s + check, which reads token.charAt(0) instead of the trimmed profileId, so -P "a, +b" asks for a profile named +b there while -P "a, -b" deactivates b. > > That looks like a slip rather than intent; I can open a PR to make MavenInvoker check profileId on master and 4.0.x so both lines agree. Yes, that sounds like a good idea. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
