I'm trying to install maven through the terminal by following these instructions.
So far I got this
export M2_HOME=/user/apple/apache-maven-3.0.3
export M2=$M2_HOME/bin
export PATH=$M2:$PATH
export JAVA_HOME=/usr/java/jdk1.6.0_22
This is probably a stupid question where do you go to find this?
for the ones that just migrated to mavericks - I used the *-ux solution;
modified .bash_profile and added:
To install Maven on OS X, go to the Apache Maven website and download the binary zip file.
You can then shift the apache-maven-3.0.5 folder in your Downloads folder to wherever you want to keep Maven; however as the rest of the process involves the command line, I recommend you do everything from there.
At the command line, you would run something like:
This is just my personal preference - to have a "Development" directory in my home directory. You can choose something else if you wish.
Next, edit ~/.profile in the editor of your choice, and add the following:
The first line is important to Maven (and must be a full explcit path); the second line is important to the shell, in order to run the "mvn" binary. If you have a variation of that second line already in .profile, then simply add ${M2_HOME}/bin to the end of it.
Now open a second terminal window and run
which should give output like...
Couple of things to note:
If you've installed the Oracle JDK 1.7, then you may find Maven reports JDK 1.6 in the above output. To solve this, add the following to your ~/.profile:
export JAVA_HOME=$(/usr/libexec/java_home)
As some have pointed out, Maven has historically been supplied either with OS X itself, or with the optional Command Line Tools for XCode. This may cease to be the case for future versions of OS X, and in fact OS X Mavericks does not include Maven. Personal opinion: This could be because they are still in beta, or it could be that Apple have taken a look at the latest Thoughtworks Technology Radar, and spotted that Maven has been moved to "Hold".
For those who wanna use maven2 in Mavericks, type:
brew tap homebrew/versions
brew install maven2
If you have already installed maven3, backup 3 links (mvn, m2.conf, mvnDebug) in
/usr/local/bin
first:mkdir bak
mv m* bak/
then reinstall:
brew uninstall maven2
(only when conflicted)brew install maven2
Alternatively, I recommend installing Homebrew for these kinds of utilities.
Then you just install Maven using:
PS: If you got a 404 error, try doing a
brew update
just before