$ {java.home} changes when running Maven on OS X

This seems like a problem that I don't see on Linux or Windows computers. I have an environment setup with JAVA_HOME derived from / usr / libexec / java _home. This is in my .bashrc file:

 export JAVA_HOME=$(/usr/libexec/java_home -version 1.7) 

that leads to:

 ~/dev/Endeavor/endeavor-sdk$ echo $JAVA_HOME /Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home 

However, when I run Maven in my project, I get an error message from the native2ascii plugin:

 [ERROR] Failed to execute goal org.codehaus.mojo:native2ascii-maven-plugin:1.0-alpha-2-SNAPSHOT:native2ascii (default) on project dataAccessServices: Error starting Sun native2ascii: -> [Help 1] 

My research indicates that I use JRE instead of JDK. This is strange as I clearly point to the JDK in my JAVA_HOME variable. However, here is the output of mvn -version:

 ~/dev/Endeavor/endeavor-sdk$ mvn -version Apache Maven 3.0.4 (r1232337; 2012-01-17 03:44:56-0500) Maven home: /usr/share/maven Java version: 1.7.0_17, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.7.5", arch: "x86_64", family: "mac" 

Note that the string "Java home:" indicates that the variable $ {java.home} has been transferred to the JRE instead of the JDK pointed to by the JAVA_HOME environment variable.

I tried setting JAVA_HOME in many places, but I cannot find a way to get maven to use the JDK at home, not the JRE.

UPDATE:

I found that this indicates that this is the expected behavior: Java_home in Maven

But this does not explain why the native2ascii plugin cannot find the necessary JDK tool.

I removed using native2ascii as this was pretty much unnecessary. So, I am avoiding the problem at this point. However, if anyone has an idea why this behaves differently in different systems, please let me know.

+6
source share
1 answer

Have you tried running mvm help:system , which should print all the values โ€‹โ€‹of environment variables that are related to maven?

0
source

Source: https://habr.com/ru/post/948949/


All Articles