Takayoshi Fujiki created MNG-5686: ------------------------------------- Summary: mvn cannot execute /usr/libexec/java_home/bin/java on OS X. Key: MNG-5686 URL: https://jira.codehaus.org/browse/MNG-5686 Project: Maven Issue Type: Bug Components: Command Line Affects Versions: 3.2.3 Environment: Mac OS X 10.9.4 Reporter: Takayoshi Fujiki Attachments: maven-bin-mvn.patch
>From 3.2.3, mvn cannot start and outputs the following error. {code} $ ./apache-maven-3.2.3/bin/mvn -version Error: JAVA_HOME is not defined correctly. We cannot execute /usr/libexec/java_home/bin/java {code} 3.2.2 doesn't have this problem. {code} $ ./apache-maven-3.2.2/bin/mvn -version Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T22:51:42+09:00) Maven home: /Users/xxx/tmp/apache-maven-3.2.2 Java version: 1.8.0_11, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_11.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.9.4", arch: "x86_64", family: "mac" {code} When I modified {{bin/mvn}} like the following, this problem was gone. {code} --- bin/mvn.orig 2014-09-10 03:33:52.000000000 +0900 +++ bin/mvn 2014-09-10 03:34:18.000000000 +0900 @@ -83,7 +83,7 @@ # # Apple JDKs # - export JAVA_HOME=/usr/libexec/java_home + export JAVA_HOME="`/usr/libexec/java_home`" fi ;; esac {code} Maybe MNG-5658 is related to this problem. {{/usr/libexec/java_home}} is a command([java_home(1)|https://developer.apple.com/library/mac/documentation/Darwin/Reference/Manpages/man1/java_home.1.html]), and {{$(command)}} is a style of [Command Substitution|http://www.tldp.org/LDP/abs/html/commandsub.html] (Another(old) style is {{`command`}}). So removing "$()" breaks the JAVA_HOME detection on OS X. -- This message was sent by Atlassian JIRA (v6.1.6#6162)