Maven安装与配置
1、下载
2、安装
(1)解压安装
将下载的压缩包apache-maven-3.6.3解压到自己设置的文件夹下
(2)配置环境变量
配置环境变量
Maven_Home : C:\apache-maven-3.6.3
Path: %Maven_Home%/bin
#查看是否配置成功
#cmd - >
mvn -v
3、更改配置文件
打开conf文件夹下settings.xml文件
<?xml version="1.0" encoding="UTF-8"?>
······
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->
<!--添加maven仓库本地地址(自定义) (------------添加位置-start-----------)-->
<localRepository>C:\apache-maven-3.6.3\maven</localRepository>
<!--添加maven仓库本地地址(自定义) (------------添加位置-end-----------)-->
<!-- interactiveMode
| This will determine whether maven prompts you when it needs input. If set to false,
| maven will use a sensible default value, perhaps based on some other setting, for
| the parameter in question.
|
| Default: true
<interactiveMode>true</interactiveMode>
-->
······
<!-- mirrors
| This is a list of mirrors to be used in downloading artifacts from remote repositories.
|
| It works like this: a POM may declare a repository to use in resolving certain artifacts.
| However, this repository may have problems with heavy traffic at times, so people have mirrored
| it to several places.
|
| That repository definition will have a unique id, so we can create a mirror reference for that
| repository, to be used as an alternate download site. The mirror site will be the preferred
| server for that repository.
|-->
<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>
-->
<!--使用阿里云maven仓库(------------添加位置-start-----------)——>
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<!--使用阿里云maven仓库(------------添加位置-end-----------)——>
</mirrors>
······
</settings>
到此maven配置完成