I am searching the best way to install and configure maven on Mac OS please?
1 Answer
There are two methods:
With brew installation:
- Install Xcode
- then launch this command on your terminal: ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" You can continue then to install mvn by taping: brew install maven
Without installing brew:
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 ~/. bash_profile – create this file if doesn’t exist.
~/.bash_profile export M2_HOME=/Users/youusername/apache-maven-3.1.1 export PATH=$PATH:$M2_HOME/bin
Finally restart the terminal. Test it using: mvn -version
-
1I strongly recommend to use the most recent Maven version which is 3.6.0 furthermore the
M2_HOME
variable is neither needed nor useful. Feb 9, 2019 at 9:33 -
One other thought about. Best is to download Maven from the homepage and follow the instructions. For this is not needed to install Homebrew... Feb 10, 2019 at 9:22