Download
Download from here: maven.apache.org/download.cg…
Or click the link to download apache-maven-3.8.7-bin.tar.gz
Setup
-
Have a JDK installation on your system. Either set the
JAVA_HOMEenvironment variable pointing to your JDK installation or have thejavaexecutable on yourPATH. -
Extract distribution archive in any directory
tar xzvf apache-maven-3.8.7-bin.tar.gz -
Add the
bindirectory of the created directoryapache-maven-3.8.7to thePATHenvironment variable- In the terminal window, type the following command and press "enter":
echo "export PATH=$PATH:/path/to/apache-maven-3.8.7/bin" >> ~/.bash_profileReplace "/path/to/apache-maven-3.8.7/bin" with the actual path to the "bin" directory on your computer. For example, if the "bin" directory is located in the "/Applications/apache-maven-3.8.7" folder, you would use the following command:
echo "export PATH=$PATH:/Applications/apache-maven-3.8.7/bin" >> ~/.bash_profileThis will add the "bin" directory to the PATH environment variable for your user account.
- To apply the changes and make the updated PATH variable available in the current terminal session, type the following command and press "enter":
source ~/.bash_profile- To confirm that you add the 'bin' directory to the PATH environment variable successfully: In the terminal window, type the following command and press "enter":
echo $PATH
This will display the current value of the PATH environment variable. Look for the "bin" directory in the list of directories that is displayed. If the "bin" directory is included in the PATH, it means that it has been successfully added to the environment variable. In this case, you should see the following directory in the list:
/Applications/apache-maven-3.8.7/binIf you do not see the "bin" directory in the list, it means that it has not been added to the PATH environment variable. In that case, you may need to check your previous steps to make sure that you have added the "bin" directory to the PATH correctly.
After you have updated the PATH variable, you should be able to run the Apache Maven command-line tools from any directory on your computer.
-
Confirm with
mvn -vin a new shell. The result should look similar toApache Maven 3.8.7 (b89d5959fcde851dcb1c8946a785a163f14e1e29) Maven home: /Applications/apache-maven-3.8.7 Java version: 1.8.0_45, vendor: Oracle Corporation Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre Default locale: en_US, platform encoding: UTF-8 OS name: "mac os x", version: "10.8.5", arch: "x86_64", family: "mac"