
- #MAVEN INSTALL MAC ZIP FILE#
- #MAVEN INSTALL MAC UPDATE#
- #MAVEN INSTALL MAC ARCHIVE#
- #MAVEN INSTALL MAC CODE#
bash_profilecommand in the terminal, now you can echo JAVA_HOME and MAVEN_HOME‘s value on the macOS terminal. To make the change take effect, run source.Now when you run echo $JAVA_HOME, or echo $MAVEN_HOME, you still can not get the value you just set in.Press esc key on the keyboard then press :wq in vim to save and quit vim editor.bash_profile.Įxport MAVEN_HOME="/Users/zhaosong/Documents/WorkSpace/tool/apache-maven-3.5.4"
In vim click esc key on the keyboard then press i key to insert the below export command in.
#MAVEN INSTALL MAC ZIP FILE#
Unzip the zip file to a local folder ( for example /Users/zhaosong/Documents/WorkSpace/tool/apache-maven-3.5.4 ). #MAVEN INSTALL MAC ARCHIVE#
Go to to download the latest maven archive file. Set MAVEN_HOME on mac is similar to set JAVA_HOME on mac, but you need to install maven first. bash_profile to make the changes take effect. Then add $JAVA_HOME/bin in the value of the system environment variable PATH like below. bash_profile.Įxport JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home But if you really know your JDK installed directory, you can add the JDK directory in the export command in. bash: /Library/Java/JavaVirtualMachines/jdk1.8.0_172.jdk/Contents/Home: is a directory Run this command in the terminal like below, you can get the real JDK installation directory.ġ92:~ zhaosong$ $(/usr/libexec/java_home) Why this command in macOS? This is because $(/usr/libexec/java_home) can return the real JDK installation home directory. In vim, press the esc key first then press i key to insert text, click esc then :wq to save and quit.Įxport JAVA_HOME="$(/usr/libexec/java_home)" bash_profilecommand in terminal and add below export command in it. You can also run ls -alto list all files under your home directory. bash_profile to make sure the file exists. Run cd ~ in terminal to go to the current user home directory. bash_profile file, this file is saved in the current user’s home directory. First, all environment variable settings are saved in the current user’s. Now, you need to verify that the installation was successful by running mvn -v in the terminal. Sudo update-alternatives -set mvn /opt/apache-maven-3.6.1/bin/mvn Sudo update-alternatives -install "/usr/bin/mvn" "mvn" "/opt/apache-maven-3.6.1/bin/mvn" 0 #MAVEN INSTALL MAC UPDATE#
After making changes in the environment file, update the maven command. Make sure you do not change any existing values, you only append :/opt/apache-maven-3.6.1/bin for PATH and M2_HOME="/opt/apache-maven-3.6.1" #MAVEN INSTALL MAC CODE#
Use the below code as an example, you can use nano or vi text editors.
Set M2_HOME and PATH to maven bin by modifying the /etc/environment file. This will extract and move the content to /opt/apache-maven-3.6.1/bin Now extract the archive using sudo tar -xvzf /tmp/apache-maven-3.6. I prefer installing in /opt/, so run cd /opt/ in the terminal. Navigate to the folder where you want to install. There may be a different version there, but the steps are the same. Download the binary apache-maven-3.6. file from Maven site to /tmp/ folder.
You can use wget or visit the link from a browser to download the binary tar file. I am assuming JDK is installed correctly in your LINUX.