---
title: "安装和配置Maven"
author: "raymond.chen"
date: "2019-09-25T19:47:05Z"
tags: []
categories: ["编程语言"]
slug: "maven"
draft: false
lastmod: "2019-10-23T13:19:16Z"
id: 2483358
url: "https://chenjumin.iteye.com/blog/2483358"
---

下载安装包： http://mirror.bit.edu.cn/apache/maven/

 

将安装包apache-maven-3.2.5-bin.tar.gz上传到/opt/software目录下

 

解压  tar -zxvf apache-maven-3.2.5-bin.tar.gz

 

配置环境变量

        打开 /etc/profile 文件，添加以下内容：

                export MAVEN\_HOME=/opt/software/apache-maven-3.2.5

                export PATH=$MAVEN\_HOME/bin:$PATH

        执行 source /etc/profile 使配置生效

        执行 mvn –v 验证安装

 

配置settings.xml

        设定本地仓库地址

               &lt;localRepository&gt;/opt/software/repository&lt;/localRepository&gt;

        配置镜像仓库

```
<mirror>  
	<id>alimaven</id>  
	<name>aliyun maven</name>  
	<url>http://maven.aliyun.com/nexus/content/groups/public/</url>  
	<mirrorOf>central</mirrorOf>          
</mirror>
```