Varun
Varun

Reputation: 4452

How to install maven 2.2.1 in redhat?

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)

  1. Is there any thing wrong in .bash_profile ?
  2. one more problem I am facing that I need to run .bash_profile every time when ever I restsrt my system or open any new terminal to run java -version

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

Answers (2)

Axel Advento
Axel Advento

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

Melvins
Melvins

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

Related Questions