How to setup path for maven
I am trying to setup a path variable for my maven installation. The system information is like:
[user1@machine1]~% whereis maven
maven: /etc/maven
[user1@machine1]~% cd /etc/maven
[user1@machine1]/etc/maven% ls
maven2-depmap.xml
should I setup path like
export MAVEN_HOME=/home/user1/etc/maven/
But based on ls
command, it seems that there does not exist the binary maven file except maven2-depmap.xml
under /etc/ma开发者_如何学编程ven/
The command is named mvn
. I have no idea what /etc/maven
would be, it seems like some crazed Linux distro person's idea of a joke; it certainly isn't a maven home.
Please download an ordinary tarball of maven from maven.apache.org, and unpack it in /opt
. You don't have to set MAVEN_HOME
, just put /opt/apache-maven-whatever/bin
in your path.
Here it is, just change path to you downloads...
# set Java, Maven and Hadoop:
JAVA_HOME="/usr/lib/java-7-oracle/jdk1.7.0_45"
export JAVA_HOME
set PATH="$PATH:$JAVA_HOME/bin"
MAVEN_HOME="/home/YOUR_NAME/Downloads/apache-maven-3.1.1"
export MAVEN_HOME
PATH=$PATH:$MAVEN_HOME/bin
HADOOP_HOME="/home/YOUR_NAME/Downloads/hadoop-1.2.1"
export HADOOP_HOME
PATH=$PATH:$HADOOP_HOME/bin
export PATH
export M2_HOME=Maven
installed location
export PATH=${M2_HOME}/bin:${PATH}
Add both the line in sudo vi /etc/profile.d/maven.sh
精彩评论