maven error when running in cygwin?

后端 未结 3 484
清酒与你
清酒与你 2021-01-20 18:25

I have cygwin in Windows 7 and downloaded and installed maven \"binaries\" and have the following set

export JAVA_HOME=/cygdrive/c/java/jdk1.7.0_11
export MA         


        
3条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-20 18:54

    I spent a couple of hours fruitlessly fiddling with different combinations of JAVA_HOME, M2_HOME and M2 after this same problem. Finally I set down to debugging the mvn script (by changing line 1 to read "#!/bin/sh -x"). It occurs because the script is relying on shell globbing to get the correct version of the .jar file (at approx. line 157):

    CLASSPATH="${M2_HOME}/boot/plexus-classworlds-*.jar"
    

    the * is not being expanded, for some reason globbing is disabled; Hence the command the script attempts to execute is:

    '/cygdrive/c/Program Files/Java/jdk1.7.0_40/bin/java' -classpath 'D:\apps\apache-maven-3.0.4\boot\plexus-classworlds-*.jar' '-Dclassworlds.conf=D:\apps\apache-maven-3.0.4\bin\m2.conf' '-Dmaven.home=D:\apps\apache-maven-3.0.4' org.codehaus.plexus.classworlds.launcher.Launcher -version
    

    when it should be:

    '/cygdrive/c/Program Files/Java/jdk1.7.0_40/bin/java' -classpath 'D:\apps\apache-maven-3.0.4\boot\plexus-classworlds-2.4.jar' '-Dclassworlds.conf=D:\apps\apache-maven-3.0.4\bin\m2.conf' '-Dmaven.home=D:\apps\apache-maven-3.0.4' org.codehaus.plexus.classworlds.launcher.Launcher -version
    

    Solution: Edit the "mvn" script and change line 157 to read:

    CLASSPATH="$(echo ${M2_HOME}/boot/plexus-classworlds-*.jar)"
    

提交回复
热议问题