Today, after the Maven3.3.3, it won't work.
cvdemacbook-pro:~in"main"51.0
The error is obviously that the JDK version running is lower than the compiled JDK version, but the local JDK is already 1.8, and maven3.3.3 only needs 1.7.
cvdemacbook-pro:~ chenwei$ java-"1.8.0_51"1.8. 0_51- 25.51-b03, Mixed mode)
Configuring the Java_home is still useless ('/usr/libexec/java_home ' means to replace the content in ' execute ',/usr/libexec/java_home is the recommended setting for Mac)
cvdemacbook-pro:apache-maven-3.3.3chenwei$Cat~/. bash_profile# Setting PATH forPython3.4# The orginal version is savedinch. Bash_profile.pysavem3_home="/users/chenwei/developers/maven/apache-maven-3.3.3"Java_home="'/usr/libexec/java_home '"PATH="/library/frameworks/python.framework/versions/3.4/bin:${path}"PATH="$JAVA _home/bin: $M 3_home/bin: $PATH"Export PATH
Then I look at the way mvn looks for java_home.
bash-3.2vi 'which mvn '
Find the Loading method inside
# # look forThe Apple JDKs first to preserve the existing behaviour, and ThenLook # forThe new JDKs provided by Oracle. # if[-Z"$JAVA _home"] && [-L/SYSTEM/LIBRARY/FRAMEWORKS/JAVAVM.FRAMEWORK/VERSIONS/CURRENTJDK]; Then# # Apple JDKs # export Java_home=/system/library/frameworks/javavm.framework/versions/currentjdk/Homefi if[-Z"$JAVA _home"] && [-L/SYSTEM/LIBRARY/JAVA/JAVAVIRTUALMACHINES/CURRENTJDK]; Then# # Apple JDKs # export Java_home=/system/library/java/javavirtualmachines/currentjdk/contents/Homefi if[-Z"$JAVA _home"] && [-l"/LIBRARY/JAVA/JAVAVIRTUALMACHINES/CURRENTJDK"] ; Then# # Oracle JDKs # export Java_home=/library/java/javavirtualmachines/currentjdk/contents/Homefi if[-Z"$JAVA _home"] && [-X"/usr/libexec/java_home"]; Then# # Apple JDKs # export Java_home= '/usr/libexec/Java_home 'fi
I think I've already configured Java_home, and there's no problem.
Debug See
bash-3.2$SH-x mvn+'['-Z"' ']'+'['-f/etc/mavenrc']'+'['-f/users/chenwei/.mavenrc']'+ cygwin=false+ darwin=false+ mingw=false+ Case "' uname '" inch++uname+ darwin=true+'['-Z"' ']'+'['-l/system/library/frameworks/javavm.framework/versions/currentjdk']'+ Export java_home=/system/library/frameworks/javavm.framework/versions/currentjdk/Home+ java_home=/system/library/frameworks/javavm.framework/versions/currentjdk/Home
Found no java_home here, so it was set to jdk1.6.
Because I firmly believe that I set up the ~/.bash.profile java_home.
Echo $JAVA _home is a value.
Then see MVN start setting #!/bin/sh, suspect sh can't find java_home
Try it.
bash-3.2shsh-3.2echo $JAVA _homesh-3.2$
So, I began to study how to set the environment variable sh, the/etc/profile in the Java_home also press. Bash_profile Way to set it up again
It's still useless.
Then began to study the shell environment variable load, see the role of Erport, I finally reacted, I set the java_home, but no export, only export the path.
Then modify the. bash_profile
SH-3.2$VI~/. bash_profile# Setting PATH forPython3.4# The orginal version is savedinch. Bash_profile.pysavem3_home="/users/chenwei/developers/maven/apache-maven-3.3.3"Java_home="'/usr/libexec/java_home '"PATH="/library/frameworks/python.framework/versions/3.4/bin:${path}"PATH="$JAVA _home/bin: $M 3_home/bin: $PATH"export Java_homeexport m3_homeexport PATH
Source a bit, and then run MVN, and finally fix it.
cvdemacbook-pro:~ chenwei$ MVN-Vapache Maven3.3.3(7994120775791599E205A5524EC3E0DFE41D4A06; --Geneva-22T19: $:Panax Notoginseng+ ,:xx) Maven Home:/users/chenwei/developers/maven/apache-maven-3.3.3Java Version:1.8. 0_51, Vendor:oracle Corporationjava home:/library/java/javavirtualmachines/jdk1.8.0_51.jdk/contents/home/Jredefault LOCALE:ZH_CN, platform Encoding:utf-8OS Name:"Mac OS X", Version:"10.10.4", Arch:"x86_64", Family:"mac"
This kind of low-level error, because it is not familiar with Linux caused, it is stupid to cry out
Remember the painful experience of configuring MAVEN on your Mac for Java_home