mthmulders commented on a change in pull request #605:
URL: https://github.com/apache/maven/pull/605#discussion_r742085865
##########
File path: maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
##########
@@ -1731,15 +1730,19 @@ static void populateProperties( CommandLine
commandLine, Properties systemProper
// are most dominant.
//
----------------------------------------------------------------------
- Arrays.stream( commandLine.getOptions() )
- .filter( option -> CLIManager.SET_SYSTEM_PROPERTY ==
option.getOpt().charAt( 0 ) )
- .map( option -> option.getValues() )
- .forEach( values ->
- {
- final String key = values[0].trim();
- final String value = values.length == 2 ? values[1] :
"true";
- setCliProperty( key, value, userProperties );
- } );
+ for ( final Option option : commandLine.getOptions() )
+ {
+ final String opt = option.getOpt();
+ // Some options do not have a "short" version (e.g. color, debug).
+ // We are specifically looking for the "-D" option.
+ if ( opt != null && CLIManager.SET_SYSTEM_PROPERTY == opt.charAt(
0 ) )
Review comment:
1. The `option` variable is the result of `commandLine.getOptions()`.
The Javadoc for that method says it returns "processed Options". I would be
very disappointed if there were a `null` in that...
2. `--define w=1` doesn't work 😱 . Commons CLI seems to look for a `--define
w` option (which doesn't exist). I'll have to dig a little deeper why that is.
--
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]