apache / apache/maven

.mvn/maven.onfig option parsing fails with --define

Open
#13,092 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
5.3k
Forks
3.1k
Avg merge
20h 42m
Merged PRs (30d)
297

Description

### Affected version

3.9.16 (4.0 as well)

### Bug description

Hello,

If you run run `mvn --define 'revision=1.0-SNAPSHOT` --version`, it runs fine and displays the version.

now, if you add the define to the `.mvn/maven.config` file:

```
--define 'revision=1.0-SNAPSHOT'
```

then, running `mvn --version` will crash displaying this (edited) help message:

```
Unable to parse maven.config file options: Unrecognized option: --define 'revision=1.0-SNAPSHOT'

usage: mvn [options] [] []

Options:
(...)
-D,--define Define a user property
(...)
```

Note: the `-D` variant is accepted in `maven.config`.

This seems to indicate that option parsing might not be aligned between the cli arguments and the `maven.config` file.

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure with Maven 3.9.16 using --define on the command line and in .mvn/maven.config. Trace the separate option-parsing paths for CLI arguments and maven.config entries; the -D form is already accepted. Done means the long --define form with its quoted property is parsed consistently without the reported error, while existing behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system, cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.