Install maven on linux

It only takes three steps to install maven on linux, but the premise is that java has been installed and JAVA_HOME is configured;

 

1. Get the maven file:

     a: Download from http://maven.apache.org/download.cgi;

     b: copied from elsewhere;

 

2. Unzip the downloaded file in 1;

    Such as unzip to /home/halfsking/ apache-maven-3.2.1

 

3. Edit profile to set global variables:

    vi /etc/profile

   append at the end

    M2_HOME= /home/halfsking/ apache-maven-3.2.1 (address is the unzipped address in 2) 

    export M2_HOME  
    PATH=$PATH:$M2_HOME/bin   
    export PATH  

 

Then: wq save, execute  source /etc/profile, and the maven installation is complete.

 

To verify whether the installation is successful, execute mvn in the shell and see the output.

 

Other additions:

After decompressing in 2, you can modify the localRepository node in conf/settings.xml to  specify the path where the local maven repository is stored, such as  <localRepository>/home/m2</localRepository>

 Others are modified as needed, such as repository private server node.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326262012&siteId=291194637
Recommended