2015年7月19日 星期日

[JAVA] Maven on Mac

Edit ~/.profile, and add the following:
export M2_HOME="/Users/menggen/Downloads/apache-maven-3.3.1" export PATH=${PATH}:${M2_HOME}/bin

Run mvn --version and get error message:
Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0

Solution: Set JAVA_HOME properly.  Edit ~/.profile and add the following:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_65.jdk/Contents/Home

Now it is okay:
$ mvn --version 
Apache Maven 3.3.1 (cab6659f9874fa96462afef40fcf6bc033d58c1c; 2015-03-14T04:10:27+08:00)
Maven home: /Users/menggen/Downloads/apache-maven-3.3.1
Java version: 1.7.0_65, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_65.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.9.5", arch: "x86_64", family: "mac"

沒有留言:

張貼留言