Maven下载与配置

1、官网下载对应版本,推荐下载免安装版

  1. [下载地址](https://archive.apache.org/dist/maven/maven-3/3.6.1/binaries/)
  2. ![](https://gitee.com/hg14150/blogiamges/raw/master/img/image-20210404133834598.png#alt=image-20210404133834598)

2、配置setting.cof

2.1、配置本地仓库
  1. <!-- localRepository
  2. | The path to the local repository maven will use to store artifacts.
  3. |
  4. | Default: ${user.home}/.m2/repository
  5. <localRepository>/path/to/local/repo</localRepository>
  6. -->
  7. <!--路径为maven解压地址-->
  8. <localRepository>D:\Major_Application\Java\maven3.6.1\repository</localRepository>

maven下载与配置 - 图1

2.2、配置阿里仓库
  1. <mirror>
  2. <id>alimaven</id>
  3. <name>aliyun maven</name>
  4. <url>http://maven.aliyun.com/nexus/content/groups/public/ </url>
  5. <mirrorOf>central</mirrorOf>
  6. </mirror>

maven下载与配置 - 图2

3、配置环境变量

win+E打开文件管理—>右击此电脑—>属性—>高级系统设置—>环境变量—>系统环境变量path,新建添加如下信息

  1. #maven解压路径\bin
  2. D:\Major_Application\Java\maven3.6.1\bin

maven下载与配置 - 图3

maven下载与配置 - 图4

4、测试

win+R打开命令提示符输入cmd,输入以下内容出现如图内容,说明大功告成啦啦啦

  1. mvn -v

maven下载与配置 - 图5

5、IDEA托管maven

  1. File -> Setting -> 搜索Maven

maven下载与配置 - 图6

配置完成apply/ok就可以啦啦啦