maven 配置指南
maven安装与下载
-
找个英文路径解压存放
配置环境变量
-
环境变量设置步骤:
-
配置JDK环境变量
- 下载地址:Java Downloads | Oracle
- 配置环境变量-JDK
- 将jdk的根目录地址存放进去键值对命名为: JAVA_HOME17 F:\jdk17-root
- 再使用键值对 JAVA_HOME %JAVA_HOME17%来选中JAVA配置
- MAVEN环境配置
- maven根目录
- 配置环境变量
- 环境变量里的path配置
- 进入path编辑页面
- 将上面的路径+bin文件层级放入path:或使用%JAVA_HOME%\bin来表达
- 配置maven仓库配置
- 寻一处文件目录创建maven仓库文件夹
- 找到maven的配置文件conf
- 进入maven根目录->conf文件夹->settings.xml
- 在setting.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>D:\tools\repository</localRepository>
- 找到标签
<mirrors></mirrors>
在标签里添加以下代码,若找不到可自行添加<mirrors></mirrors>
<!-- 阿里云仓库 -->
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<!-- 中央仓库1 -->
<mirror>
<id>repo1</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo1.maven.org/maven2/</url>
</mirror>
<!-- 中央仓库2 -->
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
- 配置idea
file->settings->搜索maven