apache / apache/maven

[MNG-7782] System properties are no longer overridden with user properties with the same name

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

Description

**[Alexey Venderov](https://issues.apache.org/jira/secure/ViewProfile.jspa?name=avenderov)** opened **[MNG-7782](https://issues.apache.org/jira/browse/MNG-7782?redirect=false)** and commented

Hi!

I've noticed the regression in the latest Maven 4.0-SNAPSHOT. System properties are no longer overridden with user properties with the same name.

In Maven 3.9.2 and earlier properties set via the command line ({_}-Duser.name=test{_}) where overriding system properties with the same name:

```java
🕙 15:01:32 ➜ mvn --version
Apache Maven 3.9.2 (c9616018c7a021c1c39be70fb2843d6f5f9b8a1c)
Maven home: /Users/avenderov/.sdkman/candidates/maven/current
Java version: 11.0.19, vendor: Azul Systems, Inc., runtime: /Users/avenderov/.asdf/installs/java/zulu-11.64.19/zulu-11.jdk/Contents/Home
Default locale: en_DE, platform encoding: UTF-8
OS name: "mac os x", version: "12.6.5", arch: "aarch64", family: "mac"
tmp/maven/dist/apache-maven-4.0.0-SNAPSHOT/bin 563ms
🕙 15:01:57 ➜ mvn -Duser.name=test help:system | grep user.name
sun.java.command=org.codehaus.plexus.classworlds.launcher.Launcher -Duser.name=test help:system
user.name=test
MAVEN_CMD_LINE_ARGS= -Duser.name=test help:system
```

 
In Maven 4.0.0-SNAPSHOT the behavior is different:

```java
🕙 15:08:23 ➜ ./mvn --version
Unable to find the root directory. Create a .mvn directory in the root directory or add the root="true" attribute on the root project's model to identify it.
Apache Maven 4.0.0-alpha-6-SNAPSHOT (a56f20199184d167326dd17650c731b4e490abd1)
Maven home: /Users/avenderov/tmp/maven/dist/apache-maven-4.0.0-SNAPSHOT
Java version: 11.0.19, vendor: Azul Systems, Inc., runtime: /Users/avenderov/.asdf/installs/java/zulu-11.64.19/zulu-11.jdk/Contents/Home
Default locale: en_DE, platform encoding: UTF-8
OS name: "mac os x", version: "12.6.5", arch: "aarch64", family: "mac"
tmp/maven/dist/apache-maven-4.0.0-SNAPSHOT/bin 573ms
🕙 15:08:40 ➜ ./mvn -Duser.name=test help:system | grep user.name
Unable to find the root directory. Create a .mvn directory in the root directory or add the root="true" attribute on the root project's model to identify it.
sun.java.command=org.codehaus.plexus.classworlds.launcher.Launcher -Duser.name=test help:system
user.name=avenderov
```

 

---

**Affects:** 4.0.0-alpha-7, 4.0.x-candidate

**Issue Links:**
- [MNG-7556](https://issues.apache.org/jira/browse/MNG-7556) Clean up notion between user properties and system properties

Contributor guide

Open the contributing guide

Research direction

Reproduce the regression with Maven 4.0.0-SNAPSHOT using `./mvn -Duser.name=test help:system` and compare it with Maven 3.9.2. Trace the command-line property handling from this entry point; done means the system output reports `user.name=test` again, while preserving the existing command-line argument output.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.