1.下载

https://archive.apache.org/dist/maven/maven-3/3.6.1/binaries/

2.解压配置

打开 apache-maven-3.6.1\conf\settings.xml 

配置本地仓库

<!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
  -->
<localRepository>W:\JAVA\Maven\apache-maven-3.6.3\repository</localRepository>

配置阿里云

<mirrors>
    <!-- mirror
     | Specifies a repository mirror site to use instead of a given repository. The repository that
     | this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
     | for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
     |
    <mirror>
      <id>mirrorId</id>
      <mirrorOf>repositoryId</mirrorOf>
      <name>Human Readable Name for this Mirror.</name>
      <url>http://my.repository.com/repo/path</url>
    </mirror>
     -->
     <mirror>
       <id>alimaven</id>
       <name>aliyun maven</name>
       <url>http://maven.aliyun.com/nexus/content/groups/public/ </url>
       <mirrorOf>central</mirrorOf>
     </mirror>

  </mirrors>

3.配置环境

鼠标点击我的电脑,右键打开属性,打开高级系统设置后,选择环境变量,在系统变量添加

变量名:MAVEN_HOME
变量值:W:\JAVA\Maven\apache-maven-3.6.1

在 Path 出添加(注意分号)

%MAVEN_HOME%\bin;

检验安装是否成功

打开 cmd 输入 “mvn -v”,如得到下信息则说明安装成功

Apache Maven 3.6.1 (d66c9c0b3152b2e69ee9bac180bb8fcc8e6af555; 2019-04-05T03:00:29+08:00)
Maven home: W:\JAVA\Maven\apache-maven-3.6.1\bin\..
Java version: 1.8.0_131, vendor: Oracle Corporation, runtime: E:\Program Files\Java\jdk1.8.0_131\jre
Default locale: zh_CN, platform encoding: GBK
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

4.IDEA配置Maven

File -> Setting -> 搜索Maven

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐