Installing Maven on Linux

Programmer light 2022-02-13 07:58:54 阅读数:368

installing maven linux

1、 download maven

Maven – Download Apache Mavenicon-default.png?t=L9C2https://maven.apache.org/download.cgi

 

  Two 、 Upload to linux The server

  decompression :tar -zxvf apache-maven-3.8.3-bin.tar.gz

  3、 ... and 、 Configuration environment

mv apache-maven-3.8.3-bin /root/maven

vi /etc/profile

Finally add

export MAVEN_HOME=/root/maven
export PATH=$MAVEN_HOME/bin:$PATH 

Four 、 Refresh environment variable  

source /etc/profile

5、 ... and 、 Check version maven

mvn -v

 

6、 ... and 、 Configure Ali warehouse , Faster compilation

cd /root/maven/conf

vi settings.xml

Find the label mirror, Annotate the original image , Change to Alibaba cloud image . Note that the indentation

<!--
    <mirror>
      <id>maven-default-http-blocker</id>
      <mirrorOf>external:http:*</mirrorOf>
      <name>Pseudo repository to mirror external repositories initially using HTTP.</name>
      <url>http://0.0.0.0/</url>
      <blocked>true</blocked>
    </mirror>
-->
<mirror>
      <id>alimaven</id>
      <name>aliyun maven</name>
      <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
      <mirrorOf>central</mirrorOf>
    </mirror>

perform mvn clean install, success

 

copyright:author[Programmer light],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/02/202202130758532488.html