Maven 安装与环境变量配置
前言:
各位同学大家好 ,最近在学习springboot的项目的开发 因为默认的idea配置的maven 下载依赖非常的慢 所以我这边就自己单独下载的maven版本 并且改成阿里的镜像 ,下载依赖的速度一下就杠杆的 今天出个教程教大家怎么配置,废话不多说 我们马上开始
准备工作
需要安装idea或者 eclipse+sts (sts 是eclipse构建springboot项目的插件 )开发工具这里就不展开讲了 请同学们自行下载idea 或者eclipse 并安装
一 下载maven 包
下载地址 : http://maven.apache.org/download.cgi

下载这两个都可以 然后解压到你电脑本地

我这边是解压到D盘的根目录
然后是环境变量的配置
MAVEN_HOME : D:\apache-maven-3.6.3 (你自己本地maven 压缩包所在根目录)
PATH: %MAVEN_HOME%\bin (系统环境变量path路径的配置)
具体配置如图:
MAVEN_HOME : D:\apache-maven-3.6.3

PATH: %MAVEN_HOME%\bin

我们打开cmd命令行 输入mvn -verison

出现如上图 maven的对应配置的版本 即表示环境变量配置成功了
二 修改setting.xml配置文件(在压缩路径的conf文件夹下)
如图:

<localRepository>D:\Program Files\repository</localRepository>

D:\Program Files\repository 这个路径配置是你要存放的资源库的地址 默认是在C:\Users\xuqing.m2\repository目录下面 目录改不改看个意愿 我只是不喜欢把这些都下载器到C盘

修改下载源
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>nexus-osc</id>
<mirrorOf>central</mirrorOf>
<name>Nexus osc</name>
<url>http://maven.oschina.net/content/groups/public/</url>
</mirror>
<mirror>
<id>nexus-osc-thirdparty</id>
<mirrorOf>thirdparty</mirrorOf>
<name>Nexus osc thirdparty</name>
<url>http://maven.oschina.net/content/repositories/thirdparty/</url>
</mirror>
把这一段加到你的settngs.xml文件中 默认是google的下载源下载非常慢 所以改成阿里云的下载源 你也可以改成其他的源如图

settings.xml的配置我们就完成了
三 ide 的配置
idea 配置方法
我们打开idea 打开settings 搜索maven 我们分别要修改
Maven home directory : 你自己电脑maven 压缩包解压的根目录
User settings files: 你自己本地的maven压缩包中的settings.xml文件路径
Local respository : 你要存放下载的资源库的路径 (跟你的settings.xml配置一致 )

eclipse配置方法

到此maven的安装和环境变量配置就OK了
最后总结
因为最近要学习springboot的项目,所以就查了资料配置了maven的环境 之前都是用的idea自带的 下载依赖非常慢 所以今天就自己配置了国内的阿里云的镜像 ,下载依赖快很多 速度杠杠的 步骤非常简单 大家按照教程一步一步来都是可以的 最后希望我的文章能帮助到各位解决问题 ,以后我还会贡献更多有用的代码分享给大家。各位同学如果觉得文章还不错 ,麻烦给关注和star,小弟在这里谢过啦