7

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/maven/

3 Answers 3

8

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
Sign up to request clarification or add additional context in comments.

Comments

7

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.

4 Comments

Thanks for the reply. But the problem is that it seems that maven works just fine on my system. Does that mean that I have to remove the existing maven and re-install it? Thanks.
No. it means that you should (a) start by typing 'which mvn' instead of 'which maven' and (b) don't bother with MAVEN_HOME at all.
In order to use mvn with Jenkins, MAVEN_HOME must be defined.
Why do you think that Jenkins is at issue here?
3

export M2_HOME=Maven installed location export PATH=${M2_HOME}/bin:${PATH}

Add both the line in sudo vi /etc/profile.d/maven.sh

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.