Skip to content

[regression] Maven4 unable to pass settings path on Windows #11487

@hohwille

Description

@hohwille

Affected version

4.0.0-rc-5

Bug description

Updating to Maven4 breaks my usage scenario:

$ echo $MAVEN_ARGS
-s D:\projects\mmm\conf\mvn\settings.xml -Dsettings.security=D:\projects\mmm\conf\mvn\settings-security.xml
$ mvn -v
[ERROR] Error executing Maven.
[ERROR] The specified user settings file does not exist: D:\projects\mmm\projectsmmmconfmvnsettings.xml

To me it looks as if maven4 does some transformation with backslashes in path's.
Maybe also the wrapper script calling maven via Java is causing this effect.
I diffed the mvn wrapper script and found that in 3.9.9 it was containing this relevant block that was removed in maven 4.0:

# For MinGW, ensure paths are in Unix format before anything is touched
if $mingw ; then
  [ -n "$MAVEN_HOME" ] &&
    MAVEN_HOME=`(cd "$MAVEN_HOME"; pwd)`
  [ -n "$JAVA_HOME" ] &&
    JAVA_HOME=`(cd "$JAVA_HOME"; pwd)`
  # TODO classpath?
fi

UPDATE: I do not believe this is related to the bug. I rather expect the bug to be in the Java code.

When I downgrade to maven 3.x it works again:

$ mvn -v
WARNING: A restricted method in java.lang.System has been called
WARNING: java.lang.System::load has been called by org.fusesource.jansi.internal.JansiLoader in an unnamed module (file:/D:/projects/mmm/software/mvn/lib/jansi-2.4.1.jar)
WARNING: Use --enable-native-access=ALL-UNNAMED to avoid a warning for callers in this module
WARNING: Restricted methods will be blocked in a future release unless native access is enabled

Apache Maven 3.9.9 (8e8579a9e76f7d015ee5ec7bfcdc97d260186937)
Maven home: D:\projects\mmm\software\mvn
Java version: 25, vendor: Eclipse Adoptium, runtime: D:\projects\mmm\software\java
Default locale: en_US, platform encoding: UTF-8
OS name: "windows 11", version: "10.0", arch: "amd64", family: "windows"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmvn4

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions