Reputation: 701
I was trying to install Apache Maven on my Mountain Lion iMac when I found out that Maven is already pre-installed on Mac OS X. I'm really new to development, and I have very little idea what I'm doing with Maven.
I ended up screwing up all of the environment variables, like
export M2_HOME=/usr/local/apache-maven-2.2.1 [This directory actually doesn't exist at all for me)
export M2=$M2_HOME/bin
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/home
export PATH=$M2:$JAVA_HOME/bin:$PATH
If you can help me out with how I can fix all of the configuration problems I did or how to restore it to factory presets for Mac OS X, that would be very much appreciated. Thank you.
Upvotes: 2
Views: 961
Reputation: 97517
The installation on Mac is working like that. You have a link under /usr/share/maven
which is like this:
/usr/share/maven -> /usr/share/java/apache-maven-3.1.0
So the simplest solution is to change the above link from the above into:
/usr/share/maven -> /usr/share/java/apache-maven-3.0.5
or
/usr/share/maven -> /usr/share/java/apache-maven-2.2.1
so you can simply create the installation into:
/usr/share/java/apache-maven-2.2.1
This can simply solved by a shell scripts like this:
#!/bin/bash
sudo rm /usr/share/maven
sudo ln -s /usr/share/java/apache-maven-2.2.1 /usr/share/maven
which can be named like maven2
and located into /usr/local/bin/
.
If you use the link methode you don't need to changed anything in your PATH
variable.
Upvotes: 4