I've just updated maven from 3.0.3 to 3.0.4 using the compiled binaries from the official site.Now when I run mvn -version , it says that it uses the old java 6 version , instead of the java 7 version that I have installed on my machine (macbook pro). If I run the 3.0.3 version maven binary from inside its folder it uses the java 7 version. How can I configure maven 3.0.4 so that it uses the Java 7 version? Thank you.
PS : Java 7 is the default java version at my system (mountain lion).
Apache Maven 3.8.6 is the latest release and recommended version for all users.
Maven needs a JDK, and not a JRE. Thanks, Ok yep it is installed.. both JDK and Maven... BUT JAVA_HOME returns Nothing...so still I have some configuration to do to set my JAVA_HOME on OSX ? and without that nothing (EClipse, IntelliJ, etc..)
To set JAVA_HOME, do the following: Right click My Computer and select Properties. On the Advanced tab, select Environment Variables, and then edit JAVA_HOME to point to where the JDK software is located, for example, C:\Program Files\Java\jdk1. 6.0_02.
Set the JAVA_HOME environment variable. and path as $JAVA_HOME/bin
From Apache maven:
Unix-based Operating Systems (Linux, Solaris and Mac OS X)
Extract the distribution archive, i.e. apache-maven-3.0.4-bin.tar.gz to the directory you wish to install Maven 3.0.4. These instructions assume you chose /usr/local/apache-maven. The subdirectory apache-maven-3.0.4 will be created from the archive. In a command terminal,
add the M2_HOME environment variable, e.g. export M2_HOME=/usr/local/apache-maven/apache-maven-3.0.4.
Add the M2 environment variable, e.g. export M2=$M2_HOME/bin
.
Optional: Add the MAVEN_OPTS environment variable to specify JVM properties, e.g. export MAVEN_OPTS="-Xms256m -Xmx512m".
This environment variable can be used to supply extra options to Maven.
Add M2 environment variable to your path, e.g. export PATH=$M2:$PATH.
Make sure that JAVA_HOME is set to the location of your JDK, e.g. export JAVA_HOME=/usr/java/jdk1.7.*
and that $JAVA_HOME/bin
is in your PATH environment variable.
Run mvn --version to verify that it is correctly installed.
Set the JAVA_HOME environment variable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With