作者有话说:
本文是我的个人学习笔记整理,如有错误,望各位大佬指正!
maven安装
下载maven安装包
登录下载地址:http://mirror.bit.edu.cn/apache/maven/maven-3/3.5.4/binaries/点击下载图示中压缩包
下载好后解压到自己相应的文件夹
环境配置
此电脑→属性→高级系统设置→环境变量→系统变量→新建 MAVEN_HOME
在Path环境变量下添加%MAVEN_HOME%\bin
到这里可以测试一下环境变量配置是否完成,打开cmd输入命令,显示下图则环境变量配置成功
setting文件配置
setting文件在我们刚下载好的maven的conf目录下(建议大家最好使用Notepad++打开该文件进行修改)
配置maven本地仓库
我们使用mavn会将相关依赖从远程仓库下载到本地仓库,此处是配置本地仓库的位置,需要手动添加以下圈出来的东西
<localRepository>D:\AlwaysSoftware\MavenRepository</localRepository>
修改依赖下载地址
maven默认的远程仓库再国外下载速度会非常慢,有的时候甚至会被拦截,所以我们一般的解决方法有两种(1)配置VPN实现翻墙。(2)使用国内的一些仓库。这里我是使用了阿里云的远程仓库
<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