The mvn command does not work on Mac OS X Yosmeti

I followed all the necessary steps, such as the following, after accessing other threads and online resources to install / configure maven. Here is what I did:

export M2_HOME=/usr/local/apache-maven/apache-maven-3.3.9

export M2=$M2_HOME/bin

My Java Home variable is also set as shown below:

echo $JAVA_HOME

/Library/Java/JavaVirtualMachines/jdk1.8.0_60/Contents/Home

export PATH=$M2:$PATH  

Despite all of the above, when I run mvn --version, I get Error: JAVA_HOME is not defined correctly. We cannot execute /Library/Java/JavaVirtualMachines/jdk1.8.0_60/Contents/Home/bin/java.

The PATH output is as follows:

 echo $PATH
/usr/local/apache-maven/apache-maven-3.3.9/bin:/usr/local/apache-maven/apache-maven-3.2.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/usr/local/MacGPG2/bin
+4
source share
2 answers

export PATH=$M2:$PATHshould be export PATH=$M2/bin:$PATHorexport PATH=$M2_HOME/bin:$PATH

Also JAVA_HOME should be something like this

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60

then

export PATH=$JAVA_HOME/bin:$PATH

What all.

All in one

export M2_HOME=/usr/local/apache-maven/apache-maven-3.3.9
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_60
export PATH=$JAVA_HOME/bin:$M2_HOME/bin:$PATH
+6
source

John

To start Maven from the command line, its path to the installation bin must be included in the PATH variable.

Windows, , MAC- :

maven - C:/temp/maven/bin C:/temp/maven/bin. .

, .

-1

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


All Articles