Reputation: 4452
I am trying to install maven 2.2.1 in redhat6
I have downloaded maven file openlogic-maven-2.2.1-all-bin-1.zip
extracted in folder called maven. after extraction I get a folder called maven-2.2.1
.This is the path where I have extracted maven /home/qaserver/app/maven
.
After that I set home path for maven in .bash_profile
.
this is the content of .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
JAVA_HOME=/home/qaserver/app/java/jdk1.6.0_45
export JAVA_HOME
M2_HOME=/home/qaserver/app/maven/maven-2.2.1
export M2_HOME
PATH=$M2/bin:$JAVA_HOME/bin:$PATH
export PATH
after setting the home path when I run mvn -version
I get bash: mvn: command not found
I have set install java same way, but my maven is not working where as when I type java -version. I get this
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)
.bash_profile
?I don't want to install maven using command.because I need to configure java and maven now and then maximum time. Thats why I want to keep the installation process simple, so that I can change it easily
Upvotes: 2
Views: 480
Reputation: 3065
On the following:
PATH=$M2/bin:$JAVA_HOME/bin:$PATH
Please use $M2_HOME
instead of $M2
. $M2
will just result to an empty string, hence your maven binary, mvn
can't be found.
Upvotes: 1
Reputation: 330
The reason is simple. Please modify it as
PATH=$M2_HOME/bin:$JAVA_HOME/bin:$PATH
The change is to use M2_HOME rather than M2.
This would do the trick. Please let know if it works.
Upvotes: 1