You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "iracanyes (via GitHub)" <gi...@apache.org> on 2026/10/12 02:44:15 UTC
[I] Maven bash script not running on Mingw environment (e.g Git bash) on Windows [maven]
iracanyes opened a new issue, #13414:
URL: https://github.com/apache/maven/issues/13414
### Affected version
master, 4.0.x, 3.10.x, 3.9.x
### Bug description
## Description
The pull request merged:
- #12568
- #12567
Made using Claude Code introduced a bug in the maven bash script ``bin/mvn`` for Mingw environment.
Mingw environment (e.g. Git bash) doesn't provide a root directory ``/cygdrive`` which is only available on Cygwin.
Using the command ``cygpath`` to convert paths for Mingw add a non-existing root directory ``/cygdrive`` to the converted path.
````bash
# maven/blob/master/apache-maven/src/assembly/maven/bin/mvn
CLASSWORLDS_JAR=`echo "${MAVEN_HOME}"/boot/plexus-classworlds-\*.jar`
CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
# For Cygwin and MinGW, switch paths to Windows format before running java(1) command
if $cygwin || $mingw ; then
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
LAUNCHER_JAR=`cygpath --windows "$LAUNCHER_JAR"`
CLASSWORLDS_CONF=`cygpath --windows "$CLASSWORLDS_CONF"`
MAVEN_HOME=`cygpath --windows "$MAVEN_HOME"`
# converted separately, appending to the already converted MAVEN_HOME would
# produce a path mixing both separators, e.g. C:\maven/lib/jline-native
JLINE_NATIVE_PATH=`cygpath --windows "$JLINE_NATIVE_PATH"`
fi
````
The consequence is that all 3 environment variables returns a false paths in Mingw environment.
and an error "Launcher class not reachable" is displayed when testing a simple maven command `mvn --help`
## Reproduction
### Requirements
1. Install Java JDK of your choice
### Step to reproduct
1. Download Apache maven 3.10.0 or 3.9.0 Zip archive and decompress it
2. Open a Mingw environment (e.g Git bash) and go to directory containing the decompressed archive
3. run a maven command using the bash script inside the bin folder ``./bin/mvn --help``
## Expected behavior
Display maven help page
````bash
$ ./bin/mvn --help
usage: mvn [options] [<goal(s)>] [<phase(s)>]
Options: ...
````
## Observed behavior
````bash
$ mvn --help
Erreur : impossible de trouver ou de charger la classe principale org.codehaus.plexus.classworlds.launcher.Launcher
Causé par : java.lang.ClassNotFoundException: org.codehaus.plexus.classworlds.launcher.Launcher
````
## Proposed solution
Use prior working code from 3.8.x if nothing conflict with it.
Convert path using cygpath only for Cygwin environment
````bash
# Remove $mingw as alternative condition for convertion using cygpath
if $cygwin ; then
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
LAUNCHER_JAR=`cygpath --windows "$LAUNCHER_JAR"`
CLASSWORLDS_CONF=`cygpath --windows "$CLASSWORLDS_CONF"`
MAVEN_HOME=`cygpath --windows "$MAVEN_HOME"`
# converted separately, appending to the already converted MAVEN_HOME would
# produce a path mixing both separators, e.g. C:\maven/lib/jline-native
JLINE_NATIVE_PATH=`cygpath --windows "$JLINE_NATIVE_PATH"`
fi
````
This solution has been tested with maven 3.10.0
## Remark: Same errors in different branches
This type of error with converted paths for Mingw using ``cypath`` is found several times in the bash script ``bin/mvn`` inside the following branches:
### branch : master (apache-maven/src/assembly/maven/bin/mvn)
#### line 106
````bash
# For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
if $cygwin || $mingw ; then
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
````
#### line 453
````bash
# For Cygwin and MinGW, switch paths to Windows format before running java(1) command
if $cygwin || $mingw ; then
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
LAUNCHER_JAR=`cygpath --windows "$LAUNCHER_JAR"`
CLASSWORLDS_CONF=`cygpath --windows "$CLASSWORLDS_CONF"`
MAVEN_HOME=`cygpath --windows "$MAVEN_HOME"`
# converted separately, appending to the already converted MAVEN_HOME would
# produce a path mixing both separators, e.g. C:\maven/lib/jline-native
JLINE_NATIVE_PATH=`cygpath --windows "$JLINE_NATIVE_PATH"`
fi
MAVEN_PROJECTBASEDIR="$MAVEN_PROJECTBASEDIR_NATIVE"
````
### branch : maven-3.9.x (apache-maven/src/bin/mvn)
#### line 137
````bash
# For Cygwin and MinGW, switch paths to Windows format before running java(1)
JANSI_NATIVE_PATH="$MAVEN_HOME/lib/jansi-native"
if $cygwin || $mingw ; then
[ -n "$MAVEN_HOME" ] &&
MAVEN_HOME=`cygpath --windows "$MAVEN_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$CLASSWORLDS_JAR" ] &&
CLASSWORLDS_JAR=`cygpath --windows "$CLASSWORLDS_JAR"`
# converted separately, appending to the already converted MAVEN_HOME would
# produce a path mixing both separators, e.g. C:\maven/lib/jansi-native
JANSI_NATIVE_PATH=`cygpath --windows "$JANSI_NATIVE_PATH"`
fi
````
### branch : maven-3.10.x (apache-maven/src/bin/mvn)
#### line 137
````bash
# For Cygwin and MinGW, switch paths to Windows format before running java(1)
JLINE_NATIVE_PATH="$MAVEN_HOME/lib/jline-native"
if $cygwin || $mingw ; then
[ -n "$MAVEN_HOME" ] &&
MAVEN_HOME=`cygpath --windows "$MAVEN_HOME"`
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$CLASSWORLDS_JAR" ] &&
CLASSWORLDS_JAR=`cygpath --windows "$CLASSWORLDS_JAR"`
# converted separately, appending to the already converted MAVEN_HOME would
# produce a path mixing both separators, e.g. C:\maven/lib/jline-native
JLINE_NATIVE_PATH=`cygpath --windows "$JLINE_NATIVE_PATH"`
fi
````
### branch : maven-4.0.x (apache-maven/src/assembly/maven/bin/mvn)
#### line 95
````bash
# For Cygwin and MinGW, ensure paths are in Unix format before anything is touched
if $cygwin || $mingw ; then
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
````
#### line 255
````bash
# For Cygwin and MinGW, switch paths to Windows format before running java(1) command
if $cygwin || $mingw ; then
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
LAUNCHER_JAR=`cygpath --windows "$LAUNCHER_JAR"`
CLASSWORLDS_CONF=`cygpath --windows "$CLASSWORLDS_CONF"`
MAVEN_HOME=`cygpath --windows "$MAVEN_HOME"`
# converted separately — appending to the already-converted MAVEN_HOME would
# produce a path mixing both separators, e.g. C:\maven/lib/jline-native
JLINE_NATIVE_PATH=`cygpath --windows "$JLINE_NATIVE_PATH"`
fi
````
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] Maven 3.10.0 bash script not running on Mingw environment (e.g Git bash) on Windows [maven]
Posted by "gnodet (via GitHub)" <gi...@apache.org>.
gnodet closed issue #13414: Maven 3.10.0 bash script not running on Mingw environment (e.g Git bash) on Windows
URL: https://github.com/apache/maven/issues/13414
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org