Where is Maven Installed on Ubuntu

后端 未结 6 865
借酒劲吻你
借酒劲吻你 2020-12-12 14:47

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 sa

相关标签:
6条回答
  • 2020-12-12 15:10

    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

    0 讨论(0)
  • 2020-12-12 15:11

    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

    0 讨论(0)
  • 2020-12-12 15:13

    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

    0 讨论(0)
  • 2020-12-12 15:15
    $ mvn --version
    

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

    0 讨论(0)
  • 2020-12-12 15:30

    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;
    
    0 讨论(0)
  • 2020-12-12 15:33

    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.

    0 讨论(0)
提交回复
热议问题