javanoob
javanoob

Reputation: 6410

Where is Maven Installed on Ubuntu

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..

Upvotes: 99

Views: 189293

Answers (9)

Kazakov Vsevolod
Kazakov Vsevolod

Reputation: 28

The Maven was installed on my Ubuntu with IntelleJIdea

(I did not install Maven directly)

The .m2 repository was created at: /home/user/.m2/ You can find this setting Settings -> Build, Execution, Deployment -> Build Tools -> Maven enter image description here

Upvotes: 0

boroboris
boroboris

Reputation: 1620

If you are using sdkman than it should be installed in:

home/(username)/.sdkman/candidates/maven/(version)

you could also use current instead of (version) if you're switching versions often.

Upvotes: 0

Manmeet Singh
Manmeet Singh

Reputation: 1

Ubuntu Show Hidden Files

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

Now .m2 folder will be visible

Upvotes: 0

izy
izy

Reputation: 1243

$ mvn --version

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

Upvotes: 55

Andrew_Dublin
Andrew_Dublin

Reputation: 745

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

Upvotes: 1

R dhabalia
R dhabalia

Reputation: 41

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

Upvotes: 0

thejartender
thejartender

Reputation: 9379

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;

Upvotes: 1

Wilhelm Kleu
Wilhelm Kleu

Reputation: 11047

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.

Upvotes: 110

ianaré
ianaré

Reputation: 3298

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

Upvotes: 50

Related Questions