Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 454
user785099 Avatar asked Jun 24 '11 00:06

user785099


People also ask

How do I create a Maven path?

3) Add Maven Path in environment variable Click on new tab if path is not set, then set the path of maven. If it is set, edit the path and append the path of maven. Here, we have installed JDK and its path is set by default, so we are going to append the path of maven. The path of maven should be %maven home%/bin.

Where do I put Maven?

Add Maven support Open an existing project, for example, a Java project. In the Project tool window, right-click your project and select Add Framework Support. In the dialog that opens, select Maven from the options on the left and click OK.


3 Answers

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.

like image 156
bmargulies Avatar answered Sep 28 '22 17:09

bmargulies


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
like image 28
Tenen Avatar answered Sep 28 '22 16:09

Tenen


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

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

like image 27
Indrajit Swain Avatar answered Sep 28 '22 15:09

Indrajit Swain