Download And Install Maven On Mac



Download And Install Maven On Mac

Download the Maven, for example apache-maven-3.1.1-bin.tar.gz. Extracts it, tar -xvf apache-maven-3.1.1-bin.tar.gz Set Maven command in environment variable: Update /. Bashprofile – create this file if doesn’t exist. To download Maven, navigate to and click on the For Linux/Unix/Mac Binary tar.gz download file to install the latest version of Apache Maven.

  • 1Maven Install
    • 1.2Mac

Maven Install

Windows

  1. Download and install Maven (at least version 2.2.1) from the Apache Maven Project site.
  2. Add <MAVEN_HOME>bin to your “Path” System Variable. (How do I add to my Path System Variable?)
Install

Mac

The following is from http://maven.apache.org/download.html for installing maven

  1. In a command terminal, add the M2_HOME environment variable, e.g. export M2_HOME=/usr/local/apache-maven/apache-maven-2.2.1.
  2. Add the M2 environment variable, e.g. export M2=$M2_HOME/bin.
  3. 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.
  4. Add M2 environment variable to your path, e.g. export PATH=$M2:$PATH.
  5. Make sure that JAVA_HOME is set to the location of your JDK, e.g. export JAVA_HOME=/usr/java/jdk1.6.0_16 and that $JAVA_HOME/bin is in your PATH environment variable.
  6. Run mvn --version to verify that it is correctly installed.

Using Macports

Using Macports you can greatly increase the simplicity of installing Maven2.

  1. Install Macports if it is not already. [1]
  2. In a command terminal type 'ports install maven2'

Linux

See Mac Maven Install above.

Configure Maven (Deprecated)

(The following steps are no longer be necessary for calendar or directory to run. They will eventually be removed from this page.)

If you cannot access the maven repository configured for your project, you like

  1. Add the following to your <MAVEN_HOME>confsettings.xml inside of the servers tag: (change the username and password)
  2. You can also add the same code to your <HOME>.m2settings.xml:
Retrieved from 'https://tech.churchofjesuschrist.org/wiki/index.php?title=Download,_install,_and_configure_Maven&oldid=8075'
This page was last modified on 11 December 2009, at 14:34.

In this tutorial, we will be going through the installation process of Maven.

If you are a WINDOWS user (if you are not, scroll down to view how to install Maven if you are a Linux or Mac user):

Before proceeding with the next steps, make sure you have JDK installed on your system. If you don’t, you can view this article for a quick step-by-step guide. To view all the necessary minimum requirements for Maven, either click here or view the image below

Download And Install Maven On Mac Download

Click here and download the latest version. You can either select the Binary version or the full version (a.k.a. with source and docs). I recommend downloading the Binary one as you can find all the source and docs online anyway.

Select the Binary edition if you don’t want the source and docs included in it. When you click on the link, it should automatically start downloading the zip file. If it doesn’t refresh the page and try again.

After your download is complete, extract the archive to C and preferably, create a folder in C named Maven and extract the files into there.

After you have created the Maven folder, extract the files from the downloaded zip file into that folder.

Download

Now we have to set up M2_HOME. Before being able to run Maven, we need to set it in the environment variables and add the “bin” to PATH.

Adding M2_HOME

  1. Right-click somewhere on This PC
    1. Select Properties
    2. On the right, select Advanced System Settings
    3. After that, click on “Environmental Variables…”
    4. Under “System variables” select New…
    5. When the input box opens, type M2_HOME as a variable name and the path to the maven
    6. Under System variables, select “Path” and click on Edit…
    7. Add the path “C:Mavenapache-maven-3.6.1bin”

Verifying if the installation has been successful

To know if the installation has been successful for you, type this in the CMD:

If you get something like:

then you are good to go.

Linux

Requirements:

  1. Download apache-maven-3.6.1-bin.tar.gz binary (if you do not want the source and docs included).
  2. typecd /optin the terminal
  3. extract the apache-maven archive into the opt directory: sudo tar -xvzf ~/Downloads/apache-maven-3.6.0-bin.tar.gz
  4. Add as environment variable:M2_HOME='/opt/apache-maven-3.6.0' and append the bin directory to the Path variable:/opt/apache-maven-3.6.0/bin
  5. Update the mvn command:
    1. sudo update-alternatives --install '/usr/bin/mvn' 'mvn' '/opt/apache-maven-3.6.0/bin/mvn' 0
    2. sudo update-alternatives --set mvn /opt/apache-maven-3.6.0/bin/mvn
  6. Add bash completion to mvn:sudo wget https://raw.github.com/dimaj/maven-bash-completion/master/bash_completion.bash --output-document /etc/bash_completion.d/mvn. This will allow you to complete Maven commands by hitting Tab a couple of times.
  7. Type mvn –version to verify if it works

MAC

  1. Open the terminal and go to the directory in which the files were extracted and login as Super User
  2. Remove the tar.gz archive by typing rm Downloads/apache-maven*bin.tar.gz
  3. Fix the permissions: chown -R root:wheel Downloads/apache-maven*
  4. Switch the maven contents: mv Downloads/apache-maven* /opt/apache-maven
  5. Archive the Admin session: exit
  6. Add Maven binaries to the path and then append:
    1. nano $HOME/.profile
    2. export PATH=$PATH:/opt/apache-maven/bin
  7. Ctrl + x to Save and Exit from nano
  8. To load the new set up execute bash
  9. To test if the installation has been successful, type mvn -version
Article Rating

Related Tutorials

Maven Download For Mac

  • How to create Java JAR file with Maven

    This tutorial will explain how to create Java JAR file with Maven with step by step guidelines and screen shots. Why Need a Java JAR…

  • How to Install and Configure Tomcat 8

    Apache Tomcat is the most common and popular java-based web container available today. In this tutorial I will show you how to install Tomcat 8…

  • Install Java 8 JDK on Ubuntu

    In this tutorial you will learn how to install latest Java 8 on Ubuntu or LinuxMint via PPA. If you are using Windows please check…