How can I make the maven installation permanent? After downloading the apache-maven to /usr/local
, I need to print the series of "export" command lines every single time I want to use it. Even after I got the maven to work, maven doesn't work when I restart the terminal.
Added this to ~/.bash_profile
:
export M2_HOME=/usr/local/apache-maven/apache-maven-3.2.1/
export PATH=$PATH:$M2_HOME/bin
Command-line:
$ export M2_HOME=/usr/local/apache-maven/apache-maven-3.2.1/
$ export M2=$M2_HOME/bin
$ export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/home
$ export PATH=$M2:$JAVA_HOME/bin:$PATH
$ mvn –-version
Apache Maven 3.2.1 (ea8b2b07643dbb1b84b6d16e1f08391b666bc1e9; 2014-02-14T12:37:52-05:00)
Maven home: /usr/local/apache-maven/apache-maven-3.2.1
Java version: 1.6.0_65, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.9.3", arch: "x86_64", family: "mac"
After restarting command-line:
$ mvn –-version
-bash: mvn: command not found
Instead of adding export PATH=$PATH:$M2_HOME/bin
to ~/.bash_profile
, I also tried adding the other export command-lines that sets M2, JAVA_HOME and PATH. This doesn't work.