Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting Up Maven 3 properly

Tags:

java

maven

fedora

How should I set up Maven 3 properly?

My environment:

  • Fedora Linux 16;
  • Java 1.7.0_22
  • Maven 3.0.4

My .bash_profile

# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
    . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/.local/bin:$HOME/bin:$JAVA_HOME/bin:$M2_HOME/bin
export PATH

JAVA_HOME=/usr/java/jdk1.7.0_02
export JAVA_HOME

M2_HOME=/home/ic/apache-maven-3.0.4
export M2_HOME

When I type java -version, the system shows me

java version "1.7.0_02"
Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
Java HotSpot(TM) Client VM (build 22.0-b10, mixed mode, sharing)

But when I type mvn -v, it shows me:

bash: mvn: command not found...

What should I do, in order to set up Maven 3 properly?

Thanks in advance!

like image 331
sonnuforevis Avatar asked Feb 03 '12 19:02

sonnuforevis


1 Answers

Ordering is important!

JAVA_HOME=/usr/java/jdk1.7.0_02
export JAVA_HOME

M2_HOME=/home/ic/apache-maven-3.0.4
export M2_HOME

# after the variables are assigned!!!
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$JAVA_HOME/bin:$M2_HOME/bin
export PATH
like image 67
Gareth Davis Avatar answered Oct 11 '22 11:10

Gareth Davis