Where is Maven Installed on Ubuntu

UbuntuMaven

Ubuntu Problem Overview


I installed maven on my Ubuntu machine with the command sudo apt-get install maven

Now I need to know where it is installed in order to configure the same in IntelliJ..

Ubuntu Solutions


Solution 1 - Ubuntu

Ubuntu, which is a Debian derivative, follows a very precise structure when installing packages. In other words, all software installed through the packaging tools, such as apt-get or synaptic, will put the stuff in the same locations. If you become familiar with these locations, you'll always know where to find your stuff.

As a short cut, you can always open a tool like synaptic, find the installed package, and inspect the "properties". Under properties, you'll see a list of all installed files. Again, you can expect these to always follow the Debian/Ubuntu conventions; these are highly ordered Linux distributions. IN short, binaries will be in /usr/bin, or some other location on your path ( try 'echo $PATH' on the command line to see the possible locations ). Configuration is always in a subdirectory of /etc. And the "home" is typically in /usr/lib or /usr/share.

For instance, according to http://www.mkyong.com/maven/how-to-install-maven-in-ubuntu/, maven is installed like:

> The Apt-get installation will install > all the required files in the > following folder structure > > /usr/bin/mvn

> /usr/share/maven2/

> /etc/maven2 > > P.S The Maven configuration is store > in /etc/maven2

Note, it's not just apt-get that will do this, it's any .deb package installer.

Solution 2 - Ubuntu

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

Solution 3 - Ubuntu

$ mvn --version

and look for Maven home: in the output , mine is: Maven home: /usr/share/maven

Solution 4 - Ubuntu

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;

Solution 5 - Ubuntu

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

Solution 6 - Ubuntu

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

Solution 7 - Ubuntu

Ubuntu Show Hidden Files

In Ubuntu -> Home -> left most Options button -> select Show hidden files

Now .m2 folder will be visible

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionjavanoobView Question on Stackoverflow
Solution 1 - UbuntuWilhelm KleuView Answer on Stackoverflow
Solution 2 - UbuntuianaréView Answer on Stackoverflow
Solution 3 - UbuntuizyView Answer on Stackoverflow
Solution 4 - UbuntuthejartenderView Answer on Stackoverflow
Solution 5 - UbuntuAndrew_DublinView Answer on Stackoverflow
Solution 6 - UbuntuR dhabaliaView Answer on Stackoverflow
Solution 7 - UbuntuManmeet SinghView Answer on Stackoverflow