Maven ignoring JAVA_HOME on OSX?

后端 未结 2 822
情书的邮戳
情书的邮戳 2020-12-31 18:30

For some reason Maven is ignoring JAVA_HOME on OSX.

I recently upgraded from java 8 build 11 to java 8 build 25 and removed 11 because of a bug fix in 25.

2条回答
  •  耶瑟儿~
    2020-12-31 19:30

    A coworker told me what the problem was. He didn't want the rep points so I'm just posting the answer for anybody who may find this via google.

    The solution is to put

    export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home
    

    in

    ~/.mavenrc
    

    Apparently for whatever reason maven gets its own profile file. Creating the above file with the above value fixed the problem immediately:

    :~ > mvn -version
    Apache Maven 3.2.3 (33f8c3e1027c3ffffde99d3cdebad2656a31e8fdf4; 2014-08-11T16:58:10-04:00)
    Maven home: /usr/local/Cellar/maven/3.2.3/libexec
    Java version: 1.8.0_25, vendor: Oracle Corporation
    Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_25.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"
    

提交回复
热议问题