1、下载maven
Maven – Download Apache Mavenhttps://maven.apache.org/download.cgi
?
?二、上传到linux服务器
?解压:tar -zxvf apache-maven-3.8.3-bin.tar.gz
?三、配置环境
mv apache-maven-3.8.3-bin /root/maven
vi /etc/profile
最后追加
export MAVEN_HOME=/root/maven export PATH=$MAVEN_HOME/bin:$PATH?
四、 刷新环境变量?
source /etc/profile
五、检查版本maven
mvn -v
?
六、配置阿里仓库,编译速度更快
cd /root/maven/conf
vi settings.xml
找到标签mirror,将原来的镜像注释,换成阿里云的镜像。注意缩进
<!-- ??? <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>
执行mvn clean install,成功
?
|