Skip to content

Backport #7958 (MNG-7205) to the 3.x line: convert paths for MinGW in bin/mvn #12537

Description

@ppkarwasz

Description

The bin/mvn script of the 3.x line converts MAVEN_PROJECTBASEDIR to Windows format only for Cygwin:

# For Cygwin, switch project base directory path to Windows format before
# executing Maven otherwise this will cause Maven not to consider it.
if $cygwin ; then
  [ -n "$MAVEN_PROJECTBASEDIR" ] &&
  MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
fi

Under MinGW (e.g., Git Bash, used by shell: bash steps on GitHub Actions Windows runners) the POSIX path falls through to exec java "-Dmaven.multiModuleProjectDirectory=/d/a/...", where the MSYS2 argument conversion rewrites it to the mixed form D:/a/... with forward slashes.

While / and \ are equivalent for the Win32 API, the mixed form breaks some applications and plugins. Passing the canonical representation of Windows paths to the JVM would prevent this class of problem.

The main branch already handles MinGW like Cygwin since #7958 (merged via #520, released in 4.0.0-alpha-2); this is safe because MSYS2 ships cygpath. Please consider backporting that change to the 3.x line.

Context

Currently due to a bug in Apache RAT 0.17-0.18 (fixed by RAT-559, not yet released), we can not use ${maven.multiModuleProjectDirectory}/.rat-excludes as the location of the exclusion file. The bug is of course in Apache RAT, but since Maven 4.x already handles MinGW and Cygwin alike, backporting the patch would work around the problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions