[MNG-7205] Simplify/unify Cygwin/MingGW handling in startup scripts

This closes #520
This commit is contained in:
Michael Osipov 2021-08-02 19:46:38 +02:00
parent a2a3df3d02
commit 5acdfb6650
4 changed files with 13 additions and 38 deletions

View File

@ -1,21 +1,9 @@
CLASSWORLDS_CONF="${MAVEN_HOME}/bin/m2.conf"
CLASSWORLDS_CONF="$MAVEN_HOME/bin/m2.conf"
# For Cygwin, ensure paths are in Unix format before anything is touched
if $cygwin ; then
[ -n "$MAVEN_HOME" ] &&
MAVEN_HOME=`cygpath --unix "$MAVEN_HOME"`
# 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"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
fi
# 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)`
fi
if [ -n "$JAVA_HOME" ] ; then
@ -96,13 +84,3 @@ concat_lines() {
MAVEN_PROJECTBASEDIR="`find_maven_basedir "$@"`"
MAVEN_OPTS="`concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config"` $MAVEN_OPTS"
# 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
export MAVEN_PROJECTBASEDIR

View File

@ -1,3 +1,3 @@
LAUNCHER_JAR=`echo "${MAVEN_HOME}"/boot/plexus-classworlds-*.jar`
LAUNCHER_JAR=`echo "$MAVEN_HOME"/boot/plexus-classworlds-*.jar`
MAVEN_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher

View File

@ -1,20 +1,18 @@
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
[ -n "$MAVEN_HOME" ] &&
MAVEN_HOME=`cygpath --path --windows "$MAVEN_HOME"`
# For Cygwin and MinGW, switch paths to Windows format before running java(1) command
if $cygwin || $mingw ; then
[ -n "$JAVA_HOME" ] &&
JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
[ -n "$CLASSPATH" ] &&
CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
[ -n "$LAUNCHER_JAR" ] &&
LAUNCHER_JAR=`cygpath --path --windows "$LAUNCHER_JAR"`
JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
LAUNCHER_JAR=`cygpath --windows "$LAUNCHER_JAR"`
CLASSWORLDS_CONF=`cygpath --windows "$CLASSWORLDS_CONF"`
MAVEN_HOME=`cygpath --windows "$MAVEN_HOME"`
MAVEN_PROJECTBASEDIR=`cygpath --windows "$MAVEN_PROJECTBASEDIR"`
fi
exec "$JAVACMD" \
$MAVEN_OPTS \
$MAVEN_DEBUG_OPTS \
-classpath "${LAUNCHER_JAR}" \
-classpath "$LAUNCHER_JAR" \
"-Dclassworlds.conf=$CLASSWORLDS_CONF" \
"-Dmaven.home=$MAVEN_HOME" \
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
"-Dmaven.multiModuleProjectDirectory=$MAVEN_PROJECTBASEDIR" \
$MAVEN_LAUNCHER "$@"

View File

@ -51,4 +51,3 @@ case "`uname`" in
MINGW*) mingw=true;;
esac