Skip to content

Conversation

@cstamas
Copy link
Member

@cstamas cstamas commented Oct 10, 2025

When CLI contains unsupported parameters, the context.options may be null, that is violated by populateUserProperties method.

Before (master):

$ mvn --encrypt-master-password xxxxx
[ERROR] Error executing Maven.
[ERROR] Error parsing program arguments
[ERROR] Caused by: Failed to parse CLI arguments: Unrecognized option: --encrypt-master-password
[ERROR] Error populating user properties
[ERROR] Caused by: Cannot invoke "org.apache.maven.api.cli.Options.userProperties()" because "context.options" is null
[ERROR] Error reading core extensions descriptor
[ERROR] Caused by: null
$

With PR:

$ mvn --encrypt-master-password 
[ERROR] Error executing Maven.
[ERROR] Error parsing program arguments
[ERROR] Caused by: Failed to parse CLI arguments: Unrecognized option: --encrypt-master-password
$

Backport of 7baf2a8

When CLI contains unsupported parameters, the `context.options` may be null, that is violated by `populateUserProperties` method.

Before (master):
```
$ mvn --encrypt-master-password xxxxx
[ERROR] Error executing Maven.
[ERROR] Error parsing program arguments
[ERROR] Caused by: Failed to parse CLI arguments: Unrecognized option: --encrypt-master-password
[ERROR] Error populating user properties
[ERROR] Caused by: Cannot invoke "org.apache.maven.api.cli.Options.userProperties()" because "context.options" is null
[ERROR] Error reading core extensions descriptor
[ERROR] Caused by: null
$
```

With PR:
```
$ mvn --encrypt-master-password 
[ERROR] Error executing Maven.
[ERROR] Error parsing program arguments
[ERROR] Caused by: Failed to parse CLI arguments: Unrecognized option: --encrypt-master-password
$
```
@cstamas cstamas changed the title Bugfix: fix CLI graceful death (#11239) [maven-4.0.x] Bugfix: fix CLI graceful death (#11239) Oct 10, 2025
@cstamas cstamas added bug Something isn't working backport labels Oct 10, 2025
@cstamas cstamas added this to the 4.0.0 milestone Oct 10, 2025
@cstamas cstamas marked this pull request as ready for review October 10, 2025 08:58
@cstamas cstamas merged commit d8f02a0 into apache:maven-4.0.x Oct 10, 2025
22 of 24 checks passed
@cstamas cstamas deleted the maven-4.0.x-fix-cli-npe branch October 10, 2025 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant