$ mvn --version
and look for Maven home: in the output
, mine is: Maven home: /usr/share/maven
I would like to add that .m2 folder a lot of people say it is in your home folder. It is right. But if use maven from ready to go IDE like Spring STS then your .m2 folder is placed in root folder
To access root folder you need to switch to super user account
sudo su
Go to root folder
cd root/
You will find it by
cd -all
Here is a bash script for newer Maven copy and paste it...
# @author Yucca Nel
#!/bin/sh
#This installs maven2 & a default JDK
sudo apt-get install maven2;
#Makes the /usr/lib/mvn in case...
sudo mkdir -p /usr/lib/mvn;
#Clean out /tmp...
sudo rm -rf /tmp/*;
cd /tmp;
#Update this line to reflect newer versions of maven
wget http://mirrors.powertech.no/www.apache.org/dist//maven/binaries/apache-maven-3.0.3-bin.tar.gz;
tar -xvf ./*gz;
#Move it to where it to logical location
sudo mv /tmp/apache-maven-3.* /usr/lib/mvn/;
#Link the new Maven to the bin... (update for higher/newer version)...
sudo ln -s /usr/lib/mvn/apache-maven-3.0.3/bin/mvn /usr/bin/mvn;
#test
mvn -version;
exit 0;
Depends on what you are looking for. If you are looking for the executable :
$ whereis mvn
If you are looking for the libs and repo :
$ locate maven
With the locate command, you could also pipe it to grep to find a particular library, i.e.
$ locate maven | grep 'jetty'
HTH
Ubuntu 11.10 doesn't have maven3 in repo.
Follow below step to install maven3 on ubuntu 11.10
sudo add-apt-repository ppa:natecarlson/maven3
sudo apt-get update && sudo apt-get install maven3
Open terminal: mvn3 -v
if you want mvn as a binary then execute below script:
sudo ln -s /usr/bin/mvn3 /usr/bin/mvn
I hope this will help you.
Thanks, Rajam
Source: Stackoverflow.com