Skip to content

Conversation

@cstamas
Copy link
Member

@cstamas cstamas commented Oct 9, 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
$

When CLI contains unsupported parameters, the context.options
may be null, that is violated by populateUserProperties method.
@cstamas cstamas self-assigned this Oct 9, 2025
@cstamas cstamas requested a review from gnodet October 9, 2025 14:07
@cstamas cstamas added the bug Something isn't working label Oct 9, 2025
@cstamas cstamas modified the milestones: 4.0.0, 4.1.0 Oct 9, 2025
@cstamas cstamas marked this pull request as ready for review October 9, 2025 14:47
@cstamas cstamas merged commit 7baf2a8 into apache:master Oct 10, 2025
16 of 19 checks passed
@cstamas cstamas deleted the fix-cli-npe branch October 10, 2025 07:39
cstamas added a commit to cstamas/maven that referenced this pull request 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
$
```
cstamas added a commit that referenced this pull request 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-4.0.x bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants